Function hyper::body::to_bytes[][src]

pub async fn to_bytes<T>(body: T) -> Result<Bytes, T::Error> where
    T: HttpBody
Expand description

Concatenate the buffers from a body into a single Bytes asynchronously.

This may require copying the data into a single buffer. If you don’t need a contiguous buffer, prefer the aggregate function.

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.