fetch implementation does not support streams from the spec - needs implementation in React Native core
See original GitHub issueReact Native has not implemented fetch on top of native APIs, and the fetch polyfill built on top of XHR does not support streams where response.body
is a getter for a ReadableStream
.
React Native version:
0.61.4
Steps To Reproduce
Use fetch
and see that response.body
is undefined rather than a getter for a ReadableStream
according the the fetch spec.
Describe what you expected to happen:
I expected for response.body
to be defined.
Related issues
https://github.com/facebook/react-native/issues/9629 https://github.com/facebook/react-native/issues/12912 https://github.com/github/fetch/issues/746#issuecomment-573251497 (cc @MattiasBuelens)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:16 (3 by maintainers)
Top Results From Across the Web
The Fetch API is finally coming to Node.js - LogRocket Blog
It's been a long time coming, but the Fetch API is now available in Node.js core. Learn why it took so long and...
Read more >Networking - React Native
React Native provides the Fetch API for your networking needs. Fetch will seem familiar if you have used XMLHttpRequest or other networking APIs ......
Read more >Suspense for Data Fetching (Experimental) - React
It is not a data fetching implementation. ... As data streams in, React retries rendering components that still need data until they're all...
Read more >node-fetch - npm
Instead of implementing XMLHttpRequest in Node.js to run ... iterators with streams did not mature until Node.js 14, so you need to do...
Read more >Web Streams Everywhere (and Fetch for Node.js) - CSS-Tricks
As the spec says, A readable stream can be piped directly to a writable ... Unlike browsers, Node core doesn't currently implement fetch....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am really interested in bringing spec-compliant fetch to react native. I think there’s renewed interest in the OSS community and JS developers to standardise where possible as seen in adding fetch to node.js core and the work Cloudflare, Vercel, Shopify et al are doing in WinterCG.
A spec compliant fetch also aligns with React Native’s goals IMO.
Has there been any discussion in how to bring spec compliant fetch to React Native? The polyfill fork is a good start but I’m not sure the caveats especially around performance and bundle size make it suitable for general adoption.
The Facebook GitHub org only contains project managed by Facebook. It’ll mean we have to take care of releases and everything. I’m not sure if that’s a good idea, you’ll probably be able to move faster on a separate org. What about react-native-community? @alloy can get you set up with that.