Disable automatic gzip compression to fix SSE streaming#1967
Merged
dgageot merged 1 commit intodocker:mainfrom Mar 7, 2026
Merged
Disable automatic gzip compression to fix SSE streaming#1967dgageot merged 1 commit intodocker:mainfrom
dgageot merged 1 commit intodocker:mainfrom
Conversation
There was a problem hiding this comment.
Review Summary
Assessment: 🟡 NEEDS ATTENTION
The PR successfully addresses the SSE streaming issue by disabling automatic gzip compression. However, there is one notable concern:
Issue Found:
- 1 MEDIUM severity: Silent fallback behavior when type assertion fails could leave gzip compression enabled in edge cases
The implementation is mostly sound. The type assertion fallback provides graceful degradation but silently defeats the purpose of the fix in scenarios where http.DefaultTransport has been replaced (e.g., in test environments). Consider adding error handling or using a fresh transport to ensure compression is always disabled.
Findings
1 finding requires attention.
Go's default HTTP transport adds Accept-Encoding: gzip and transparently decompresses responses. This is incompatible with SSE streaming because gzip requires buffering the complete payload before decompression, causing "unexpected end of JSON input" errors with providers like OpenRouter. Clone the default transport with DisableCompression=true in NewHTTPClient, and consolidate the header tests into a single table-driven test with a shared helper. Fixes docker#1956 Assisted-By: cagent
2d92b01 to
292ec9d
Compare
trungutt
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Go's default HTTP transport adds
Accept-Encoding: gzipand transparently decompresses responses. This is incompatible with SSE streaming because gzip requires buffering the complete payload before decompression, causingunexpected end of JSON inputerrors with providers like OpenRouter.Changes
DisableCompression=trueinNewHTTPClient, using a safe type assertion with graceful fallbackdoRequesthelperFixes #1956