Method
CurlResponse::withHeader
Return an instance with the provided value replacing the specified header.
Description#
public CurlResponse::withHeader(
string $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 string
- Case-insensitive header field name.
- $value
- Header value(s).
Return values#
MessageInterface
Errors / Exceptions#
| Exception | When |
|---|---|
InvalidArgumentException | For invalid header names or values. |