WordPress\AiClientDependencies\Nyholm\Psr7

Request::__constructpublicWP 1.0

Method of the class: Request{}

No Hooks.

Returns

null. Nothing (null).

Usage

$Request = new Request();
$Request->__construct( $method, $uri, $headers, $body, $version );
$method(string) (required)
HTTP method.
$uri(string|UriInterface) (required)
URI.
$headers(array)
Request headers.
Default: []
$body(string|resource|StreamInterface|null)
Request body.
Default: null
$version(string)
Protocol version.
Default: '1.1'

Request::__construct() code WP 7.0

public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1')
{
    if (!$uri instanceof UriInterface) {
        $uri = new Uri($uri);
    }
    $this->method = $method;
    $this->uri = $uri;
    $this->setHeaders($headers);
    $this->protocol = $version;
    if (!$this->hasHeader('Host')) {
        $this->updateHostFromUri();
    }
    // If we got no body, defer initialization of the stream until Request::getBody()
    if ('' !== $body && null !== $body) {
        $this->stream = Stream::create($body);
    }
}