Skip to content

[CHA-0] feat: request gzip-compressed API responses - #220

Merged
razkevich merged 2 commits into
masterfrom
feature/cha-0-gzip-responses
Nov 2, 2026
Merged

razkevich merged 2 commits into
masterfrom
feature/cha-0-gzip-responses

Conversation

@razkevich

Copy link
Copy Markdown
Contributor

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)
  • Commit message fits conventional commits. Important for CHANGELOG generation.

Description of the pull request

The default HttpClient never sets AutomaticDecompression, so it sends no Accept-Encoding and the API returns every response uncompressed. This turns on gzip for both default handlers (HttpClientHandler and SocketsHttpHandler). A caller-supplied ClientOptions.HttpClient is untouched.

The API already serves gzip, brotli and zstd to every client that asks; only this SDK's default client doesn't ask. One server-side app using 2.1.1 pulls ~232 GB/day of QueryChannels responses (avg 334 KB) uncompressed. A live QueryChannels response measured 240 KB plain vs 17 KB gzipped.

Testing (no dotnet test changes; the existing suite needs live credentials):

  • All 9 target frameworks build with 0 warnings / 0 errors.
  • Local server checking the request: master sends no Accept-Encoding (14.5 KB on the wire); this branch sends gzip (388 B), decodes the body and still reads the rate-limit headers, for both the net6.0 (SocketsHttpHandler) and netstandard2.0 (HttpClientHandler) builds.
  • Against the production API: QueryChannels (30 channels × 30 messages) through this branch's default client and through a plain HttpClient deserialize to identical objects, rate limits included, on both builds.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@razkevich
razkevich merged commit 6b68771 into master Nov 2, 2026
5 checks passed
@razkevich
razkevich deleted the feature/cha-0-gzip-responses branch November 2, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants