Skip to content

[Bug/错误]: Requests with Content-Encoding: zstd fail to decode JSON body #1680

@cesaryuan

Description

@cesaryuan

Pre-submission Checklist / 提交前检查

  • I have searched the existing issues and this bug has not been reported
  • I have read the documentation
  • I am using the latest version of AxonHub

FAQ Check / FAQ 检查

  • I have checked the FAQ and this bug is not covered there

Bug Description / Bug 描述

When a client sends a request to AxonHub with Content-Encoding: zstd, AxonHub appears to read the compressed request body as raw JSON instead of decoding it first. This causes the OpenAI Responses API request decoder to fail with a JSON parse error.

The observed failure happens on /v1/responses, but the request body is read through the shared HTTP request parsing path, so other JSON endpoints that receive zstd-compressed request bodies may be affected as well.

Steps to Reproduce / 复现步骤

  1. Start AxonHub.
  2. Send an OpenAI Responses API request to /v1/responses with a valid JSON body compressed using zstd.
  3. Include the request header Content-Encoding: zstd.
  4. Observe that AxonHub rejects the request while decoding the Responses API payload.

Example request shape:

POST /v1/responses HTTP/1.1
Content-Type: application/json
Content-Encoding: zstd
Authorization: Bearer <redacted>

<zstd-compressed JSON body>

Original uncompressed JSON body is valid JSON, for example:

{"model":"<model>","input":"hello"}

Expected Behavior / 期望行为

AxonHub should detect Content-Encoding: zstd, decode the request body before JSON parsing/transformation, and avoid forwarding an already-decoded body with the stale Content-Encoding: zstd header to upstream providers.

If zstd request body compression is intentionally unsupported, AxonHub should return a clear unsupported content encoding error instead of a misleading JSON parse error.

Error Message / 错误消息

{
  "error": {
    "message": "invalid request: failed to decode responses api request: invalid character '(' looking for beginning of value",
    "type": "invalid_request_error"
  }
}

Operating System / 操作系统

Windows / Windows

AxonHub Version / AxonHub 版本

unstable branch at commit aab5159a (chore: sync model developers data (#1675))

Usage Scenario / 使用场景

API

API Format / API 格式

OpenAI - Responses (/v1/responses)

Channel Type / 渠道类型

Custom/Other

Logs / 日志

No additional server logs captured. The client-visible error is included above.

Additional Context / 其他补充信息

The behavior suggests the compressed body bytes are passed directly into JSON decoding. A likely area to inspect is the shared HTTP request body reading path before inbound transformers parse JSON bodies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions