fetch
fetch copied to clipboard
Allow request take AsyncIterable body?
Would be possible/make sense to add AsyncIterable
to the extract body algorithm? This would help with interopt with Node streams when implementing fetch in Node without violating the spec.
Maybe.
However, we are going to add ReadableStream.from() to the Streams Standard which will at least make it trivial to construct a body from an AsyncIterable
.
Remember asking the exact same question a long time ago, but it got rejected by ReadableStream.from()
https://github.com/whatwg/fetch/issues/809
@jimmywarting I don't think it got rejected, but you suggested to close it in favor of that API. Or am I missing something?
yea, pretty much
I really think this should be part of the standard. It makes Response so much easier to work with in Node.js, as we need to maintain backward compatibility with Node streams without incurring in the overhead of wrapping one stream type in another.
(Node.js ships this exactly for this reason).
If this change is welcomed, I’m happy to champion this change and send a PR for it.
In principle I'm supportive of this. The part that seems most tricky is how to make this work IDL-wise.
The part that seems most tricky is how to make this work IDL-wise.
Some guidance on this would be fantastic.
I have opened a PR to Web IDL with an attempt for how to make this work IDL wise: https://github.com/whatwg/webidl/pull/1397