ServerHttpRequest.readBody

Reads the body of this request and transfers it to the given output stream, limited by the request's "Content-Length" unless you choose to allow infinite reading. If the request includes a header for "Transfer-Encoding: chunked", then it will wrap the input stream in one which decodes HTTP chunked-encoding first.

struct ServerHttpRequest
StreamResult
readBody
(
S
)
(,
bool allowInfiniteRead = false
)
if (
isByteOutputStream!S
)

Parameters

outputStream S

The output stream to transfer data to.

allowInfiniteRead bool

Whether to allow reading the request even if the Content-Length header is missing or invalid. Use with caution!

Return Value

Type: StreamResult

Either the number of bytes read, or a stream error.