You are here

public function Request::__construct in Lockr 7.3

Parameters

string $method HTTP method:

string|UriInterface $uri URI:

array $headers Request headers:

string|null|resource|StreamInterface $body Request body:

string $version Protocol version:

1 call to Request::__construct()
ServerRequest::__construct in vendor/guzzlehttp/psr7/src/ServerRequest.php
1 method overrides Request::__construct()
ServerRequest::__construct in vendor/guzzlehttp/psr7/src/ServerRequest.php

File

vendor/guzzlehttp/psr7/src/Request.php, line 32

Class

Request
PSR-7 request implementation.

Namespace

GuzzleHttp\Psr7

Code

public function __construct($method, $uri, array $headers = [], $body = null, $version = '1.1') {
  if (!$uri instanceof UriInterface) {
    $uri = new Uri($uri);
  }
  $this->method = strtoupper($method);
  $this->uri = $uri;
  $this
    ->setHeaders($headers);
  $this->protocol = $version;
  if (!isset($this->headerNames['host'])) {
    $this
      ->updateHostFromUri();
  }
  if ($body !== '' && $body !== null) {
    $this->stream = stream_for($body);
  }
}