Skip to main content

validate_request_body

Function validate_request_body 

Source
pub fn validate_request_body(
    content_length: Option<&str>,
    transfer_encoding: Option<&str>,
    max_body_bytes: u64,
) -> Result<(), RequestValidationError>
Expand description

Validate that a request has no body, as expected for GET/HEAD.

Checks:

  • No Content-Length and Transfer-Encoding together
  • No non-empty Transfer-Encoding
  • Content-Length (if present) is zero or valid and within max_body_bytes