Support React-Native Response object#572
Merged
AlexandrHoroshih merged 3 commits intomasterfrom Jan 21, 2026
Merged
Conversation
✅ Deploy Preview for farfetched ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR adds support for React Native's Response object implementation, which doesn't include the Streams API. React Native responses have response.body set to null/undefined and lack the tee() method.
Changes:
- Modified response handling to detect Streams API availability and fallback to
response.clone()for React Native - Updated the
drainfunction to check for WritableStream availability and usestream.cancel()as a fallback - Added comprehensive test coverage for React Native compatibility scenarios
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/core/src/libs/lohyphen/drain.ts |
Added WritableStream availability check with fallback to stream.cancel() for React Native |
packages/core/src/libs/lohyphen/__tests__/drain.test.ts |
Added comprehensive tests for drain function including React Native environment simulation |
packages/core/src/fetch/json.ts |
Modified checkEmptyResponse to detect Streams API and use response.clone() fallback for React Native |
packages/core/src/fetch/api.ts |
Updated response cloning logic to handle both Streams API and React Native environments |
packages/core/src/fetch/__tests__/react_native_compat.test.ts |
Added comprehensive test suite for React Native compatibility using a proxy-based Response mock |
.changeset/tricky-balloons-swim.md |
Added changeset entry for the patch |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
React-Native Response object implementation never has a
response.bodyand correspoding streams=> we need to fallback the
createJson*implementation according to that