Repository navigation
feat(decompress): add preserveHeaders option - #6239
Merged
Merged
Conversation
Add a preserveHeaders option, defaulting to false. When enabled, keep Content-Encoding and Content-Length in both normalized headers and controller.rawHeaders while still decompressing the response body. This allows jsdom to reuse the interceptor for XMLHttpRequest, whose response headers describe the encoded response even though its body is decoded. Co-authored-by: GPT-6 Astra · Extra High <codex@openai.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6239 +/- ##
==========================================
+ Coverage 91.71% 91.74% +0.02%
==========================================
Files 113 113
Lines 44835 44842 +7
==========================================
+ Hits 41121 41140 +19
+ Misses 3714 3702 -12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Add a preserveHeaders option, defaulting to false. When enabled, keep Content-Encoding and Content-Length in both normalized headers and controller.rawHeaders while still decompressing the response body.
This allows jsdom to reuse the interceptor for XMLHttpRequest, whose response headers describe the encoded response even though its body is decoded.
This relates to...
#6046 and jsdom/jsdom#4469.
Rationale
I’d like jsdom to reuse undici’s decompression interceptor for XMLHttpRequest, which exposes the original response headers alongside the decoded body. Currently, doing so requires an adapter to capture and restore the headers.
Changes
Features
Add a
preserveHeadersoption that retainsContent-EncodingandContent-Lengthin both response headers andcontroller.rawHeaderswhile decompressing the body. It defaults tofalse, preserving existing behavior.Bug Fixes
N/A.
Breaking Changes and Deprecations
None.
Status