You are here

public function Request::withHeader in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/psr7/src/Request.php \GuzzleHttp\Psr7\Request::withHeader()

Return an instance with the provided value replacing the specified header.

While header names are case-insensitive, the casing of the header will be preserved by this function, and returned from getHeaders().

This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that has the new and/or updated header and value.

Parameters

string $name Case-insensitive header field name.:

string|string[] $value Header value(s).:

Return value

self

Throws

\InvalidArgumentException for invalid header names or values.

Overrides MessageInterface::withHeader

File

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

Class

Request
PSR-7 request implementation.

Namespace

GuzzleHttp\Psr7

Code

public function withHeader($header, $value) {

  /** @var Request $newInstance */
  $newInstance = $this
    ->withParentHeader($header, $value);
  return $newInstance;
}