Instance Method
data(max:)
The body’s bytes, collecting the stream first if nothing has collected it yet.
func data(max: BodySizeLimit = .default) async throws -> Data?
Parameters
maxThe ceiling, as
collect(max:).
Return Value
The body’s bytes, or nil if the request has no body.
Discussion
The collecting counterpart to data, and what most handlers want: it does not care whether the body arrived on a socket or was already materialised, and an already-collected body is returned without re-reading anything.
Throws
Abort with .contentTooLarge if the body exceeds max.