public function Request::__construct in Zircon Profile 8.0
Same name in this branch
- 8.0 vendor/symfony/http-foundation/Request.php \Symfony\Component\HttpFoundation\Request::__construct()
- 8.0 vendor/symfony/browser-kit/Request.php \Symfony\Component\BrowserKit\Request::__construct()
- 8.0 vendor/zendframework/zend-diactoros/src/Request.php \Zend\Diactoros\Request::__construct()
- 8.0 vendor/guzzlehttp/psr7/src/Request.php \GuzzleHttp\Psr7\Request::__construct()
- 8.0 vendor/jcalderonzumba/gastonjs/src/NetworkTraffic/Request.php \Zumba\GastonJS\NetworkTraffic\Request::__construct()
Same name and namespace in other branches
- 8 vendor/guzzlehttp/psr7/src/Request.php \GuzzleHttp\Psr7\Request::__construct()
Parameters
null|string $method HTTP method for the request.:
null|string $uri URI for the request.:
array $headers Headers for the message.:
string|resource|StreamInterface $body Message body.:
string $protocolVersion HTTP protocol version.:
Throws
InvalidArgumentException for an invalid URI
File
- vendor/
guzzlehttp/ psr7/ src/ Request.php, line 36
Class
- Request
- PSR-7 request implementation.
Namespace
GuzzleHttp\Psr7Code
public function __construct($method, $uri, array $headers = [], $body = null, $protocolVersion = '1.1') {
if (is_string($uri)) {
$uri = new Uri($uri);
}
elseif (!$uri instanceof UriInterface) {
throw new \InvalidArgumentException('URI must be a string or Psr\\Http\\Message\\UriInterface');
}
$this->method = strtoupper($method);
$this->uri = $uri;
$this
->setHeaders($headers);
$this->protocol = $protocolVersion;
$host = $uri
->getHost();
if ($host && !$this
->hasHeader('Host')) {
$this
->updateHostFromUri($host);
}
if ($body) {
$this->stream = stream_for($body);
}
}