fix: decode zstd responses while restoring claude encoding

This commit is contained in:
ciat-777
2026-03-21 15:38:11 +08:00
parent 17a4281117
commit 7a2953ac36
12 changed files with 146 additions and 16 deletions
@@ -83,7 +83,7 @@ function buildClaudeRuntimeHeaders(input: {
'User-Agent': getInputHeader(input.claudeHeaders, 'user-agent') || CLAUDE_DEFAULT_USER_AGENT,
Connection: 'keep-alive',
Accept: input.stream ? 'text/event-stream' : 'application/json',
'Accept-Encoding': 'identity',
'Accept-Encoding': 'gzip, deflate, br, zstd',
};
if (input.isClaudeOauthUpstream) {
headers.Authorization = `Bearer ${input.tokenValue}`;
@@ -70,7 +70,7 @@ describe('resolveProviderProfile', () => {
expect(result.headers.Authorization).toBe('Bearer oauth-access-token');
expect(result.headers['x-api-key']).toBeUndefined();
expect(result.headers['anthropic-version']).toBe('2023-06-01');
expect(result.headers['Accept-Encoding']).toBe('identity');
expect(result.headers['Accept-Encoding']).toBe('gzip, deflate, br, zstd');
expect(result.runtime).toMatchObject({
executor: 'claude',
modelName: 'claude-opus-4-6',