Skip to content

feat(requester-node-http): add gzip compression for requests and response decompression#1603

Open
Fluf22 wants to merge 1 commit intov4from
feat/gzip-compression-support
Open

feat(requester-node-http): add gzip compression for requests and response decompression#1603
Fluf22 wants to merge 1 commit intov4from
feat/gzip-compression-support

Conversation

@Fluf22
Copy link
Contributor

@Fluf22 Fluf22 commented Feb 6, 2026

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.

…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.
@Fluf22 Fluf22 self-assigned this Feb 6, 2026
@Fluf22 Fluf22 requested a review from shortcuts February 6, 2026 15:47
if (request.data !== undefined) {
req.write(request.data);
if (shouldCompress) {
req.write(zlib.gzipSync(request.data));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the default is 3

https://nodejs.org/api/zlib.html

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