W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2014

Re: [whatwg] Questions about the Fetch API

From: Domenic Denicola <domenic@domenicdenicola.com>
Date: Mon, 14 Jul 2014 16:17:39 +0000
To: Anne van Kesteren <annevk@annevk.nl>, Juan Ignacio Dopazo <jdopazo@yahoo-inc.com>
Message-ID: <1405354674527.92507@domenicdenicola.com>
Cc: "whatwg@lists.whatwg.org" <whatwg@lists.whatwg.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
From: Juan Ignacio Dopazo <jdopazo@yahoo-inc.com>

> I agree that Node's design sounds a bit better for piping. But where would you put the FetchResponseBodyStream? fetch() returns a promise for a Response. Why would the response have a writable stream for the request? There are two options:
>
> 1- Have fetch() return a promise for an object with "request" and "response" properties
> 2- Have fetch() return something that is not a promise

3- have fetch() take a writable stream as a parameter, e.g.

var request = new Request("http://example.com", { method: "POST" });
myReadableStream.pipeTo(request.body);
fetch(request);

(this is not great ergonomically, but seems to be the direction the current API points to...)
Received on Monday, 14 July 2014 16:18:10 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:21 UTC