Method
Response::withAddedHeader
Return an instance with the specified header appended with the given value.
Description#
public Response::withAddedHeader(
$name,
$value
): MessageInterfaceExisting values for the specified header will be maintained. The new value(s) will be appended to the existing list. If the header did not exist previously, it will be added.
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 header and/or value.
Parameters#
- $name
- Case-insensitive header field name to add
- $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 |