Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Feat: Add HTTP compression E2E test#123

Merged
VikramAditya33 merged 1 commit into
mainfrom
fix/compression
May 11, 2026
Merged

Feat: Add HTTP compression E2E test#123
VikramAditya33 merged 1 commit into
mainfrom
fix/compression

Conversation

@VikramAditya33

@VikramAditya33 VikramAditya33 commented May 11, 2026

Copy link
Copy Markdown
Collaborator

Tests added:

  • Gzip compression
  • Brotli compression
  • Compression threshold
  • Accept-Encoding negotiation
  • Compressed streaming

Closes #120

Summary by CodeRabbit

  • Tests
    • Added comprehensive end-to-end test coverage for HTTP response compression behavior, including encoding negotiation, payload threshold handling, and streaming scenarios.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a944d508-be16-4782-83b6-53ca1672cfb6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/compression

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/http/compression.e2e.spec.ts`:
- Around line 37-41: The test for non-compressible content-type is ineffective
because image(`@Res`() res: UwsResponse) currently sends a tiny Buffer so
compression is skipped by the threshold rather than by content-type; update the
test handler (image) to send a payload larger than the compression threshold
(e.g., allocate >1024 bytes) or set the compression threshold to 0 for this test
so compression decision is driven by Content-Type 'image/png' and then keep the
assertion block in the spec (the checks around compression headers/assertions)
to validate that image/png is not compressed.
- Around line 60-61: Replace the fixed port constant (port = 13358) and any
other hardcoded port usage with dynamic port allocation and bind to the loopback
address: stop using the literal port variable and instead start the test server
with port 0 and host '127.0.0.1' (e.g., server.listen(0, '127.0.0.1', ...)),
then read the assigned port from server.address().port for constructing URLs;
update any references to the original port variable (including the other
occurrence around line 81) to use the discovered port so tests avoid port
collisions and use an explicit loopback host.
- Around line 105-117: The httpGet helper currently creates an
http.ClientRequest (variable req) but never sets a request-level timeout, so
tests can hang; update the httpGet function to call req.setTimeout(<timeoutMs>,
() => req.destroy(new Error('Request timeout'))) (or similar) after creating
req, ensure the timeout value is configurable or a defined constant, and make
sure the request 'error' handler and response listeners properly handle the
destroyed request so the Promise rejects on timeout; reference the existing
local variable req and the httpGet function to locate where to add
req.setTimeout and the timeout error handling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 68d9e247-5f50-4ba1-9b94-69e07f97deb4

📥 Commits

Reviewing files that changed from the base of the PR and between 1773fc0 and 791cc90.

📒 Files selected for processing (1)
  • test/http/compression.e2e.spec.ts

Comment thread test/http/compression.e2e.spec.ts
Comment thread test/http/compression.e2e.spec.ts
Comment thread test/http/compression.e2e.spec.ts
@FOSSFORGE FOSSFORGE deleted a comment from coderabbitai Bot May 11, 2026
@VikramAditya33 VikramAditya33 merged commit 6a23811 into main May 11, 2026
3 checks passed
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.

Compression E2E tests

1 participant