Conversation
Signed-off-by: lprnmns <manasalperen@gmail.com>
There was a problem hiding this comment.
Pull request overview
Normalizes request Content-Encoding values for case-insensitive decompression matching.
Changes:
- Lowercases string encoding headers before lookup.
- Adds mixed-case gzip regression coverage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
index.js |
Normalizes request encoding values. |
test/global-decompress.test.js |
Tests mixed-case gzip handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+435
to
+437
| if (typeof encoding === 'string') { | ||
| encoding = encoding.toLowerCase() | ||
| } |
Author
There was a problem hiding this comment.
Good catch. Fixed in bb726a3: matching still uses the normalized value, while the callback and default error receive the original header value. The existing callback test now covers a mixed-case unsupported token; npm test and lint pass.
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.
Problem
HTTP content-coding names are case-insensitive, but request decompression currently compares the
Content-Encodingvalue exactly. A client sending a valid mixed-case value such asContent-Encoding: GzIpreceives a 415 response instead of having its gzip payload decompressed.Fix
Normalize the request
Content-Encodingvalue to lowercase before checking the configured supported encodings. The change is limited to the request decompression hook and adds regression coverage for mixed-case gzip.Tests
npm run test:unit -- test/global-decompress.test.js— passed (18 tests)npm run lint— passednpm test— passed (235 unit tests and 10 TypeScript assertions)npm run benchmark --if-present— passed; benchmark control stayed within the 10% tolerancegit diff --check— passedCompatibility
Lower-case request headers and forced request encodings keep their existing behavior. Only string
Content-Encodingheader matching is normalized; no public API or dependency changes are made.Related issue
No current issue or pull request was found for mixed-case request
Content-Encodinghandling. This is an independent reproduction of the protocol case-sensitivity defect; it is distinct from open PR #425, which addresses responseAccept-Encodingnegotiation for issue #305.Checklist
npm run test && npm run benchmark --if-present