-
Notifications
You must be signed in to change notification settings - Fork 385
Description
MDN documentation of Request states:
Note: The body type only can be a Blob, BufferSource, FormData, URLSearchParams, USVString or ReadableStream type, so for adding a JSON object to the payload it need to be stringify that object.
Though at MDN documentation for Request() ReadableStream is not listed as valid option.
body: Any body that you want to add to your request: this can be a Blob, BufferSource, FormData, URLSearchParams, or USVString object. Note that a request using the GET or HEAD method cannot have a body.
Could not find an example of the same at the specification. After searching before posting the question here or at stackoverflow, found that the question had already recently been asked Fetch with ReadableStream.
Tried a slightly different pattern than the javascript at Question at SO, though result was essentially the same. Is this possible? Is MDN documentation incorrect? If possible, what is the correct pattern to achieve the expected result of fetch() reading from ReadableStream to populate the body of a POST request?
Edit: Related #378