Skip to main content

check_content_length_header

Function check_content_length_header 

Source
pub async fn check_content_length_header<B>(
    __arg0: State<usize>,
    request: Request<B>,
) -> Result<Request<B>, LxRejection>
Expand description

Checks the CONTENT_LENGTH header and returns an early rejection if the contained value exceeds our configured body limit. This optimization allows us to avoid unnecessary work processing the request further.

NOTE: This does not enforce the body length!! Use DefaultBodyLimit in combination with axum::RequestExt::with_limited_body to do so.