101 if (!isset(self::$validProtocolVersions[
$version])) {
103 'Invalid HTTP version. Must be one of: ' 104 . implode(
', ', array_keys(self::$validProtocolVersions))
107 $clone = clone $this;
144 return $this->headers->all();
157 return $this->headers->has(
$name);
176 return $this->headers->get(
$name, []);
200 return implode(
',', $this->headers->get(
$name, []));
220 $clone = clone $this;
221 $clone->headers->set(
$name, $value);
244 $clone = clone $this;
245 $clone->headers->add(
$name, $value);
264 $clone = clone $this;
265 $clone->headers->remove(
$name);
300 $clone = clone $this;
301 $clone->body =
$body;
getHeaders()
Retrieves all message header values.
getBody()
Gets the body of the message.
withAddedHeader($name, $value)
Return an instance with the specified header appended with the given value.
withHeader($name, $value)
Return an instance with the provided value replacing the specified header.
getHeaderLine($name)
Retrieves a comma-separated string of the values for a single header.
Abstract message (base class for Request and Response)
HTTP messages consist of requests from a client to a server and responses from a server to a client...
withProtocolVersion($version)
Return an instance with the specified HTTP protocol version.
static $validProtocolVersions
getProtocolVersion()
Retrieves the HTTP protocol version as a string.
Slim Framework (https://slimframework.com)
hasHeader($name)
Checks if a header exists by the given case-insensitive name.
withBody(StreamInterface $body)
Return an instance with the specified message body.
getHeader($name)
Retrieves a message header value by the given case-insensitive name.
__set($name, $value)
Disable magic setter to ensure immutability.
withoutHeader($name)
Return an instance without the specified header.