Re: [whatwg] Questions about the Fetch API

Just doublechecking...does this API allow the user agent to specify the
Content-Length in the request? Or is chunked transfer encoding required for
fetch()? I don't see any mention of a length attribute for streams in
https://whatwg.github.io/streams/ (let me know if I'm looking in the wrong
place). Or is there a requestType analog for XHR's responseType?

Cheers.


On Mon, Jul 14, 2014 at 9:24 AM, Jake Archibald <jaffathecake@gmail.com>
wrote:

> On 14 July 2014 17:17, Domenic Denicola <domenic@domenicdenicola.com>
> wrote:
>
> > 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...)
>
>
> The current API is
>
> var request = new Request("http://example.com", {
>   method: "POST",
>   body: myReadableStream
> });
>

Received on Monday, 14 July 2014 21:11:15 UTC