feat(requester-node-http): add gzip compression for requests and response decompression#1603
Open
feat(requester-node-http): add gzip compression for requests and response decompression#1603
Conversation
…onse decompression When the accept-encoding header includes gzip, request bodies are compressed with zlib.gzipSync() and a content-encoding: gzip header is added. Responses with content-encoding: gzip are decompressed via zlib.createGunzip(). Decompression errors resolve gracefully following the existing error handling pattern (never reject). Includes 8 comprehensive tests covering compression, decompression, error handling, multi-value headers, and full round-trip scenarios.
Ant-hem
reviewed
Feb 6, 2026
| if (request.data !== undefined) { | ||
| req.write(request.data); | ||
| if (shouldCompress) { | ||
| req.write(zlib.gzipSync(request.data)); |
Member
There was a problem hiding this comment.
what's the default compression level of the lib? 4 is what we use in the backend it's the best balance between compression and CPU usage.
Contributor
Author
There was a problem hiding this comment.
I believe the default is 3
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.
When the accept-encoding header includes gzip, request bodies are compressed with zlib.gzipSync() and a content-encoding: gzip header is added. Responses with content-encoding: gzip are decompressed via zlib.createGunzip(). Decompression errors resolve gracefully following the existing error handling pattern (never reject).
Includes 8 comprehensive tests covering compression, decompression, error handling, multi-value headers, and full round-trip scenarios.