Skip to content

fix(fetch): preserve non-compressed responses - #848

Merged
kettanaito merged 2 commits into
mainfrom
fix/fetch-response-conditional
Sep 28, 2026
Merged

kettanaito merged 2 commits into
mainfrom
fix/fetch-response-conditional

Conversation

@kettanaito

@kettanaito kettanaito commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Discovery

  • Response instances don't need any special status/clone handling since the environment already guarantees their correctness.
  • FetchResponse instances already have the status/clone special handling because they were constructed manually.
  • Compressed responses still need new FetchResponse() because a response's body cannot be replaced in-place.
  • This change also means that environments with custom Response implementation, like React Native or workerd), now keep behaving as per those environment's specifics.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 0703d327-854b-4184-b83e-1b0583578866

📥 Commits

Reviewing files that changed from the base of the PR and between f32b8e3 and ddade8d.

📒 Files selected for processing (5)
  • src/interceptors/fetch/utils/decompression.ts
  • src/interceptors/fetch/web.ts
  • src/utils/fetch-utils.test.ts
  • src/utils/fetch-utils.ts
  • test/modules/fetch/response/fetch-response-instance.neutral.test.ts
 _________________________________
< Never fear, CodeRabbit is here! >
 ---------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

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.

@pkg-pr-new

pkg-pr-new Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/mswjs/interceptors/@mswjs/interceptors@848

commit: 87fb7a1

@kettanaito
kettanaito merged commit f6c7e42 into main Sep 28, 2026
7 checks passed
@kettanaito
kettanaito deleted the fix/fetch-response-conditional branch September 28, 2026 12:30
@kettanaito

Copy link
Copy Markdown
Member Author

Released: v0.45.5 🎉

This has been released in v0.45.5.

Get these changes by running the following command:

npm i @mswjs/interceptors@latest

Predictable release automation by Release.

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.

Fetch interceptor returns empty body when the raw Response has no public body property (React Native)

1 participant