Add a flag to specify streaming requirements on the request body#82
Add a flag to specify streaming requirements on the request body#82guoye-zhang wants to merge 1 commit intoapple:mainfrom
Conversation
|
I'm not sure I understand what a body "requiring streaming" means? It's the body that decides whether it writes all bytes at once or if it chunks it up, why would it need to communicate it elsewhere? |
|
The body always writes chunk by chunk. |
|
Why should the body type make requirements on the client implementation? This type is just a wrapper of a closure, it's the producer of the request body data. All it does it writes the bytes on-demand. If we want to put specific requirements on the behavior of the client, I think it should go on the client instead. |
|
I'm not sure we need this. I think bi-direcitonal streaming is a requirement that every client needs to support. |
|
The reason this is on the request body is that different call sites might have different requirements. Most uploads have small bodies (e.g. JSON POST requests). For large file uploads or advanced streaming use cases, streaming would be required. If all client backends support streaming, great, no one needs to check this flag at all. This is for browser |
A new flag on HTTPClientRequestBody to explicitly allow a
fetchclient backend to buffer the request body.I'm still debating whether using a missing feature should throw or just
fatalErrorto be more obvious.