Function hyper::body::aggregate

source ·
pub async fn aggregate<T>(body: T) -> Result<impl Buf, T::Error>
where T: HttpBody,
Expand description

Aggregate the data buffers from a body asynchronously.

The returned impl Buf groups the Bufs from the HttpBody without copying them. This is ideal if you don’t require a contiguous buffer.

Note

Care needs to be taken if the remote is untrusted. The function doesn’t implement any length checks and an malicious peer might make it consume arbitrary amounts of memory. Checking the Content-Length is a possibility, but it is not strictly mandated to be present.