You are here

protected function ServicesContext::getRequestMethodFromGlobals in Services 7.3

Retrieve request method from global variables.

Return value

string For example GET, POST

1 call to ServicesContext::getRequestMethodFromGlobals()
ServicesContext::getRequestMethod in servers/rest_server/includes/ServicesContext.inc
Determine Request Method of the request.

File

servers/rest_server/includes/ServicesContext.inc, line 95

Class

ServicesContext

Code

protected function getRequestMethodFromGlobals() {
  $server =& $this->data['server'];
  $get =& $this->data['get'];
  $method = $server['REQUEST_METHOD'];
  if ($method == 'POST' && isset($server['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
    $method = $server['HTTP_X_HTTP_METHOD_OVERRIDE'];
  }
  if ($method == 'POST' && isset($get['_method']) && $get['_method']) {
    $method = $get['_method'];
  }
  if (isset($get['_method'])) {
    unset($get['_method']);
  }
  return $method;
}