• Hai Chang's avatar
    feat(httputil): decode compressed request bodies (zstd/gzip/deflate) · 798fd673
    Hai Chang authored
    Codex CLI 0.125+ defaults to sending request bodies with
    Content-Encoding: zstd. Without server-side decompression the gateway
    returns 'Failed to parse request body' on /v1/responses (and any other
    JSON endpoint) because gjson sees raw zstd bytes.
    
    ReadRequestBodyWithPrealloc now inspects Content-Encoding and
    transparently decodes zstd, gzip/x-gzip, and deflate bodies before
    returning them, then strips the encoding headers and updates
    ContentLength so downstream code can reuse the bytes safely.
    Unsupported encodings produce a clear error.
    
    Adds unit tests covering identity, zstd, gzip, deflate, unsupported
    encoding, corrupt zstd payloads, nil bodies, and explicit identity.
    798fd673
body.go 2.04 KB