pub fn bytes() -> impl Filter<Extract = (Bytes,), Error = Rejection> + Copy
Expand description
Returns a Filter
that matches any request and extracts a Future
of a
concatenated body.
The contents of the body will be flattened into a single contiguous
Bytes
, which may require memory copies. If you don’t require a
contiguous buffer, using aggregate
can be give better performance.
§Warning
This does not have a default size limit, it would be wise to use one to prevent a overly large request from using too much memory.
§Example
use warp::{Buf, Filter};
let route = warp::body::content_length_limit(1024 * 32)
.and(warp::body::bytes())
.map(|bytes: bytes::Bytes| {
println!("bytes = {:?}", bytes);
});