Re: [whatwg/fetch] Streaming upload (Issue #1438)

@lucacasonato , @yutakahirano : Step 6 from https://github.com/whatwg/fetch/issues/1438#issuecomment-1158981343 would not work for me. I am going to stream live audio/video data, so the fetch() promise would never complete. That makes no sense.

Also, I wouldn't know when I can start streaming. I need to know when the response headers are returned. It makes no sense to start streaming, if the server is not going to give a 404 error, or 401, or all kinds of other issues that can be trivially sorted out before. Also, if the fetch promise does not resolve, how do I know _when_ I can start streaming? I am not going to start streaming blindly. Even if there is some kind of event, that is an unnatural API to block the `await fetch()` and then continue in some event handler. Why block, if processing needs to continue by sending the stream?

It would make sense that the fetch promise resolves once the response headers are received and the stream can _start_, not when it finishes. This would also match the down stream API, where fetch() promise resolves once the response headers are returned, but before the down stream is completed. The up stream should behave exactly the same.

Please remove step 6 and just do the same as in step 7. This would be a more consistent API, more logical - because I have a clear moment when I can start streaming -, and also work better for live streaming cases to resolve the `fetch()`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1438#issuecomment-1160549610
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1438/1160549610@github.com>

Received on Monday, 20 June 2022 14:55:44 UTC