Documentation Packages Getting Started FAQ Support

Http Server β‹… RequestBody

RequestBody extends Payload and allows streamed and buffered access to an InputStream. Additionally, it allows increasing the body size limit dynamically and allows access to the request trailers.

Constructor

public function __construct(
    InputStream $stream,
    callable $upgradeSize = null,
    Promise $trailers = null
)

Parameters

InputStream $stream Request payload.
callable
null
$upgradeSize Callback used to increase the maximum size of the body.
Promise
null
$trailers Promise for trailing headers.

increaseSizeLimit(int $limit)

Increases the size limit dynamically if an $upgradeSize callback is present. Otherwise this is a no-op.

getTrailers(): Promise

Allows access to the Trailers of a request once the promise resolves.