Repository navigation
[v7.x] fix(decompress): join a repeated content-encoding header (#5664) - #6026
Merged
mcollina merged 1 commit intoOct 17, 2026
Conversation
parseHeaders turns a repeated field into an array, and this method's own JSDoc already types the headers record as string | string[] | undefined. An array is truthy, so the skip check let it through and toLowerCase threw a TypeError. RFC 9110 section 5.3 allows joining repeated field lines with commas, which produces the single-line form the decompression chain already splits and handles, including the maxContentEncodings guard. (cherry picked from commit a975197)
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v7.x #6026 +/- ##
=======================================
Coverage 93.15% 93.16%
=======================================
Files 112 112
Lines 37626 37632 +6
=======================================
+ Hits 35052 35058 +6
Misses 2574 2574 β View full report in Codecov by Harness. π New features to boost your workflow:
|
metcoder95
approved these changes
Oct 16, 2026
Merged
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.
This relates to...
Backport of #5664 to v7.x.
Rationale
On v7.x, a response that repeats the
Content-Encodingheader reaches the decompress interceptor as an array, andonResponseStartcallstoLowerCase()on it. With the test from #5664 applied tov7.x, the request fails withTypeError: contentEncoding.toLowerCase is not a function.Changes
git cherry-pick -x).lib/interceptor/decompress.jsapplied cleanly. The test file only conflicted because v7.x has extra tests at the end of the file, so the new test is appended after them unchanged.Note: #6024 also appends a test at the end of
test/interceptors/decompress.js, so whichever of the two lands second needs a trivial rebase. I'll take care of it.Features
N/A
Bug Fixes
Content-Encodingfield lines (RFC 9110 section 5.3) instead of throwing.Breaking Changes and Deprecations
N/A
Status
Tested locally on Linux with Node 24:
node --test test/interceptors/decompress.js(46 pass),npm run lintandnpm run test:unit(1324 tests, 1321 pass, 3 skipped, 0 fail).