mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
refactor(compression): 请求压缩策略改为跟随客户端行为,响应支持gzip压缩
- 移除全局 ENABLE_REQUEST_COMPRESSION 配置,改为根据客户端 Content-Encoding 决定是否对上游请求体进行 gzip 压缩 - 非流式响应根据客户端 Accept-Encoding 返回 gzip 压缩的 JSON - ApiRequestContext 记录客户端编码偏好并透传至 handler 链路 - 新增 http_compression 模块统一处理压缩相关判断逻辑 - 上游请求头丢弃列表新增 content-encoding 防止客户端值泄露 - ensure_json_body 支持解压 gzip 编码的请求体
This commit is contained in:
@@ -101,6 +101,7 @@ class TestBuildUpstreamHeaders:
|
||||
"X-Api-Key": "client",
|
||||
"User-Agent": "ua",
|
||||
"Content-Type": "text/plain",
|
||||
"Content-Encoding": "gzip",
|
||||
},
|
||||
"openai:chat",
|
||||
"provider",
|
||||
@@ -112,6 +113,7 @@ class TestBuildUpstreamHeaders:
|
||||
assert result["Authorization"] == "Bearer provider"
|
||||
assert result["User-Agent"] == "extra"
|
||||
assert result["Content-Type"] == "text/plain"
|
||||
assert "Content-Encoding" not in result
|
||||
assert result["X-Endpoint"] == "1"
|
||||
assert result["X-Extra"] == "1"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user