pub fn validate_content_length(
content_length: usize,
config: &BodyConfig,
) -> Result<(), BodyError>Expand description
Validates body size against Content-Length header before reading.
Call this early (before buffering) to reject oversized requests.
§Arguments
content_length- The Content-Length header valueconfig- Body reading configuration
§Errors
Returns BodyError::TooLarge if the content length exceeds the limit.