Method
Request::withHeader
Return an instance with the provided value replacing the specified header.
Description#
public Request::withHeader(
$name,
$value
): MessageInterfaceWhile 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#
- $name
- Case-insensitive header field name
- $value
- Header value(s)
Return values#
MessageInterface
Errors / Exceptions#
| Exception | When |
|---|---|
InvalidArgumentException | For a name that is not an RFC 7230 token, or a value that is not a string or a non-empty list of strings, or contains a control character |