| Methods |
public
|
getBodyAsStream(): resource
Returns the body as a readable stream resource.
Returns the body as a readable stream resource.
Note that the stream may not be rewindable, and therefore may only be
read once.
Implements
|
#
|
public
|
getBodyAsString(): string
Returns the body as a string.
Returns the body as a string.
Note that because the underlying data may be based on a stream, this
method could only work correctly the first time.
Implements
|
#
|
public
|
getBody(): resource|string|callable
Returns the message body, as its internal representation.
Returns the message body, as its internal representation.
This could be either a string, a stream or a callback writing the body to php://output.
Implements
|
#
|
public
|
setBody(resource|string|callable $body)
Replaces the body resource with a new stream, string or a callback writing the body to php://output.
Replaces the body resource with a new stream, string or a callback writing the body to php://output.
Implements
|
#
|
public
|
getHeaders(): array
Returns all the HTTP headers as an array.
Returns all the HTTP headers as an array.
Every header is returned as an array, with one or more values.
Implements
|
#
|
public
|
hasHeader(string $name): bool
Will return true or false, depending on if a HTTP header exists.
Will return true or false, depending on if a HTTP header exists.
Implements
|
#
|
public
|
getHeader(string $name): string|null
Returns a specific HTTP header, based on its name.
Returns a specific HTTP header, based on its name.
The name must be treated as case-insensitive.
If the header does not exist, this method must return null.
If a header appeared more than once in a HTTP request, this method will
concatenate all the values with a comma.
Note that this not make sense for all headers. Some, such as
Set-Cookie cannot be logically combined with a comma. In those cases
you should use getHeaderAsArray().
Implements
|
#
|
public
|
getHeaderAsArray(string $name): string[]
Returns a HTTP header as an array.
Returns a HTTP header as an array.
For every time the HTTP header appeared in the request or response, an
item will appear in the array.
If the header did not exist, this method will return an empty array.
Implements
|
#
|
public
|
setHeader(string $name, string|string[] $value)
Updates a HTTP header.
Updates a HTTP header.
The case-sensitivity of the name value must be retained as-is.
If the header already existed, it will be overwritten.
Implements
|
#
|
public
|
setHeaders(array $headers)
Sets a new set of HTTP headers.
Sets a new set of HTTP headers.
The headers array should contain headernames for keys, and their value
should be specified as either a string or an array.
Any header that already existed will be overwritten.
Implements
|
#
|
public
|
addHeader(string $name, string|string[] $value)
Adds a HTTP header.
Adds a HTTP header.
This method will not overwrite any existing HTTP header, but instead add
another value. Individual values can be retrieved with
getHeadersAsArray.
Implements
|
#
|
public
|
addHeaders(array $headers)
Adds a new set of HTTP headers.
Adds a new set of HTTP headers.
Any existing headers will not be overwritten.
Implements
|
#
|
public
|
removeHeader(string $name): bool
Removes a HTTP header.
Removes a HTTP header.
The specified header name must be treated as case-insensitive.
This method should return true if the header was successfully deleted,
and false if the header did not exist.
Implements
|
#
|
public
|
setHttpVersion(string $version)
Sets the HTTP version.
Sets the HTTP version.
Should be 1.0, 1.1 or 2.0.
Implements
|
#
|
public
|
getHttpVersion(): string
Returns the HTTP version.
Returns the HTTP version.
Implements
|
#
|