[][src]Function rweb::filters::body::content_length_limit

pub fn content_length_limit(limit: u64) -> impl Filter + Copy

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());