Method
ServerRequest::withBody
Return an instance with the specified message body.
Description#
public ServerRequest::withBody(
$body
): MessageInterfaceThe body MUST be a StreamInterface object.
This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return a new instance that has the new body stream.
Parameters#
- $body
- Body.
Return values#
MessageInterface
Errors / Exceptions#
| Exception | When |
|---|---|
InvalidArgumentException | When the body is not valid. |