You are here

function rest_server_request_parsers in Services 7.3

Same name and namespace in other branches
  1. 6.3 servers/rest_server/rest_server.module \rest_server_request_parsers()

Builds a list of request parsers that are available to the RESTServer.

Return value

array An associative array of parser callbacks keyed by mime-type.

2 calls to rest_server_request_parsers()
rest_server_setup_settings in servers/rest_server/rest_server.module
Set up settings for a rest server endpoint, fills the settings array with defaults. This is done to ensure that the default state is consistent between what's shown by default in the settings form and used by default by the REST server if it…
ServicesRESTServerFactory::getParsers in servers/rest_server/includes/ServicesRESTServerFactory.inc

File

servers/rest_server/rest_server.module, line 52

Code

function rest_server_request_parsers() {
  static $parsers = NULL;
  if (!$parsers) {
    $parsers = array(
      'application/x-www-form-urlencoded' => 'ServicesParserURLEncoded',
      'application/json' => 'ServicesParserJSON',
      'multipart/form-data' => 'ServicesParserMultipart',
      'application/xml' => 'ServicesParserXML',
      'text/xml' => 'ServicesParserXML',
    );
    if (($library = libraries_load('spyc')) && !empty($library['loaded'])) {
      $parsers['application/x-yaml'] = 'ServicesParserYAML';
    }
    drupal_alter('rest_server_request_parsers', $parsers);
  }
  return $parsers;
}