Skip to main content

extract_body

Function extract_body 

Source
pub fn extract_body(headers: &HeaderMap, raw: Bytes) -> Result<String, String>
Expand description

Extract the request body as a UTF-8 string, decompressing if the Content-Encoding header indicates compression.

Supported encodings:

  • gzip — decompressed via flate2
  • zstd — decompressed via the zstd crate (used by Codex CLI)
  • (none / identity) — passed through as-is

When no Content-Encoding header is present, sniffs gzip (0x1f 0x8b) and zstd (0x28 0xb5 0x2f 0xfd) magic bytes as a fallback.