[whatwg/fetch] allow to pass a ReadableStream as Request Body (#978)

# Motivation

I would like to be able to pass a stream as body to a HTTP request sent via fetch-API. In particular, I would like to send some metadata (serialised JSON), followed by some file contents (octet-stream) specified via `<input/>` in a single HTTP request.

# My Investigations so far

I found out by trial-and-error and reading documentation that it is possible to pass a file descriptor as returned from `<input/>`'s `files` attribute as request body. So I figured it should be possible to also pass a ReadableStream. If this were possible, one could construct a ReadableStream, that first returns chunks from e.g. the afforementioned file descriptor, followed by other contents.

However, when trying this (against a http server I setup for testing purposes), passing a ReadableStream would result in a string representation of the passed stream object's name (as opposed to its contents) would be sent.

# Proposal

Allow passing of ReadableStream objects. Maybe, support passing a list of streams, or a list of objects, which would then be concatenated.

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

Received on Monday, 9 December 2019 17:45:10 UTC