This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
Feature detect streaming and fall back to regular request/response reading if not available #2848
Labels
kind/resolved-in-helia
pkg:http-client
Issues related only to ipfs-http-client
status/ready
Ready to be worked
Feature detect streaming and fall back to regular request/response reading if not available.
This would involve using a helper lib with the response that handles the case where
res.body
is undefined and instead parses the JSON from a vanilla, non-streaming response and transforms it to an iterable in another way rather than throughtoIterable
, which assumes aReadableStream
from thefetch
spec as an input.React Native is one such environment where
res.body
is undefined.In the long run, hopefully React Native will implement a spec-compatible
fetch
natively rather than using a polyfill on top of XHR, but in the meantime it would be nice not to gate potential users of this lib.Related discussion here JakeChampion/fetch#746 (comment) cc @MattiasBuelens
The text was updated successfully, but these errors were encountered: