Function warp::filters::body::content_length_limit

source ·
pub fn content_length_limit(
    limit: u64,
) -> impl Filter<Extract = (), Error = Rejection> + Copy
Expand description

Require a content-length header to have a value no greater than some limit.

Rejects if content-length header is missing, is invalid, or has a number larger than the limit provided.

§Example

use warp::Filter;

// Limit the upload to 4kb...
let upload = warp::body::content_length_limit(4096)
    .and(warp::body::aggregate());