You are here

public function Request::__construct in RESTful 7.2

Constructor.

Parses the URL and the query params. It also uses input:// to get the body.

File

src/Http/Request.php, line 139
Contains \Drupal\restful\Http\Request

Class

Request
Deals with everything coming from the consumer.

Namespace

Drupal\restful\Http

Code

public function __construct($path, array $query, $method = 'GET', HttpHeaderBag $headers, $via_router = FALSE, $csrf_token = NULL, array $cookies = array(), array $files = array(), array $server = array(), $parsed_body = NULL) {
  $this->path = $path;
  $this->query = !isset($query) ? static::parseInput() : $query;
  $this->query = $this
    ->fixQueryFields($this->query);

  // If the method is empty, fall back to GET.
  $this->method = $method ?: static::METHOD_GET;
  $this->headers = $headers;
  $this->viaRouter = $via_router;
  $this->csrfToken = $csrf_token;
  $this->cookies = $cookies;
  $this->files = $files;
  $this->server = $server;
  $this->parsedBody = $parsed_body;

  // Allow implementing modules to alter the request.
  drupal_alter('restful_parse_request', $this);
}