Skip to main content

emit_decompress_error

Function emit_decompress_error 

Source
pub fn emit_decompress_error(
    encoding: &str,
    error: Error,
    max_decompressed_size: usize,
) -> ErrorMessage
Expand description

Maps a decompression failure to a response. If error is a DecompressedSizeLimitExceeded (the decompressed output exceeded the configured size cap), it becomes a 413 Payload Too Large reporting max_decompressed_size (the cap that was actually enforced), matching the request-body and snappy size errors. Any other decode failure emits an HttpDecompressError event and becomes a 422 Unprocessable Entity.

Callers whose error is not already an std::io::Error (e.g. snappy) wrap it via std::io::Error::other.