You are here

public function MessageInterface::withHeader in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/psr/http-message/src/MessageInterface.php \Psr\Http\Message\MessageInterface::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.

2 methods override MessageInterface::withHeader()
Message::withHeader in vendor/symfony/psr-http-message-bridge/Tests/Fixtures/Message.php
Return an instance with the provided value replacing the specified header.
Request::withHeader in vendor/guzzlehttp/psr7/src/Request.php
Return an instance with the provided value replacing the specified header.

File

vendor/psr/http-message/src/MessageInterface.php, line 132

Class

MessageInterface
HTTP messages consist of requests from a client to a server and responses from a server to a client. This interface defines the methods common to each.

Namespace

Psr\Http\Message

Code

public function withHeader($name, $value);