Re: [whatwg] Questions about the Fetch API

2014-07-27 Thread Anne van Kesteren
On Thu, Jul 17, 2014 at 9:34 PM, Domenic Denicola dome...@domenicdenicola.com wrote: With that taken care of, I still think it would be ideal for the (client) RequestBodyStream to be writable, not readable. See my earlier example for why that would be problematic. One thing that might work

Re: [whatwg] Questions about the Fetch API

2014-07-17 Thread Domenic Denicola
Will and I hashed this out offline. Our tentative conclusion for streams is captured in https://github.com/whatwg/streams/issues/146. In short, the issue he brings up is a potential issue for not just the fetch body stream, but for any writable stream. As such it needs to be addressed

Re: [whatwg] Questions about the Fetch API

2014-07-16 Thread 陈智昌
On Tue, Jul 15, 2014 at 2:06 PM, Domenic Denicola dome...@domenicdenicola.com wrote: From: willc...@google.com willc...@google.com on behalf of William Chan (陈智昌) willc...@chromium.org Can you explain this in more detail? AFAICT, the fundamental difference we're talking about here is push

Re: [whatwg] Questions about the Fetch API

2014-07-14 Thread Domenic Denicola
From: Juan Ignacio Dopazo jdop...@yahoo-inc.com Why would this not be passing a writable stream object as body parameter? It would have to be a readable stream. Otherwise, how would the request be able to consume it? So most people would have to pass a stream that is both readable and

Re: [whatwg] Questions about the Fetch API

2014-07-14 Thread Domenic Denicola
From: whatwg whatwg-boun...@lists.whatwg.org on behalf of Domenic Denicola dome...@domenicdenicola.com Of these, 1 seems much nicer, based on my Node.js experience. To be clearer as to why this is: stream APIs work much better when things you write to are represented as writable streams

Re: [whatwg] Questions about the Fetch API

2014-07-14 Thread Anne van Kesteren
On Mon, Jul 14, 2014 at 5:43 PM, Domenic Denicola dome...@domenicdenicola.com wrote: Does this make sense? Does it work? No. If I submit a form and there's a service worker installed, the service worker will want to do this: var data = event.request.body.toFormData() --

Re: [whatwg] Questions about the Fetch API

2014-07-14 Thread Juan Ignacio Dopazo
On Monday, July 14, 2014 12:44 PM, Domenic Denicola dome...@domenicdenicola.com wrote: From: Juan Ignacio Dopazo jdop...@yahoo-inc.com Thus I'd suggest renaming FetchBodyStream to ResponseBodyStream (FetchResponseBodyStream?) and introducing a new RequestBodyStream without the readAsX()

Re: [whatwg] Questions about the Fetch API

2014-07-14 Thread Domenic Denicola
From: Juan Ignacio Dopazo jdop...@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:

Re: [whatwg] Questions about the Fetch API

2014-07-14 Thread Jake Archibald
On 14 July 2014 17:17, Domenic Denicola dome...@domenicdenicola.com wrote: From: Juan Ignacio Dopazo jdop...@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

Re: [whatwg] Questions about the Fetch API

2014-07-14 Thread 陈智昌
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

Re: [whatwg] Questions about the Fetch API

2014-07-14 Thread 陈智昌
On Mon, Jul 14, 2014 at 8:56 AM, Domenic Denicola dome...@domenicdenicola.com wrote: From: whatwg whatwg-boun...@lists.whatwg.org on behalf of Domenic Denicola dome...@domenicdenicola.com Of these, 1 seems much nicer, based on my Node.js experience. To be clearer as to why this is: stream

Re: [whatwg] Questions about the Fetch API

2014-07-11 Thread Anne van Kesteren
On Thu, Jul 10, 2014 at 9:05 PM, Domenic Denicola dome...@domenicdenicola.com wrote: We are doing a very good job IMO on preparing the spec for readable stream integration, with the FetchBodyStream scaffold. We need to spend similar effort preparing for writable stream integration. I would be

Re: [whatwg] Questions about the Fetch API

2014-07-10 Thread Juan Ignacio Dopazo
On Wednesday, July 9, 2014 3:02 AM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Jul 8, 2014 at 11:35 AM, Juan Ignacio Dopazo jdop...@yahoo-inc.com wrote: - And more importantly, why does fetch() return a PromiseResponse instead of a Response? Because you aren't allowed to do

Re: [whatwg] Questions about the Fetch API

2014-07-10 Thread Domenic Denicola
From: whatwg whatwg-boun...@lists.whatwg.org on behalf of Juan Ignacio Dopazo jdop...@yahoo-inc.com Would it be to crazy to get fetch(url).asJSON() to work? Either by not having fetch() return a promise (and return something that has a function that returns a promise for the headers) or by

Re: [whatwg] Questions about the Fetch API

2014-07-09 Thread Tab Atkins Jr.
On Tue, Jul 8, 2014 at 11:35 AM, Juan Ignacio Dopazo jdop...@yahoo-inc.com wrote: - And more importantly, why does fetch() return a PromiseResponse instead of a Response? Because you aren't allowed to do network fetches sync. (And if you have an async action, returning a Promise for its

[whatwg] Questions about the Fetch API

2014-07-08 Thread Juan Ignacio Dopazo
Hi, I have a couple of questions about the Fetch API. - Is the Request class supposed to be exposed as a global object that can be used on its own? - And more importantly, why does fetch() return a PromiseResponse instead of a Response? Thanks, Juan