yutakahirano / fetch-with-streams

Fetch API integrated with Streams.
66 stars 8 forks source link

Use bodyWriter instead of letting body be a function #3

Closed domenic closed 9 years ago

domenic commented 9 years ago

See discussion in f4609c95c4743a16f2192aa37386a746f02e2bd3 and slightlyoff/ServiceWorker#413.

yutakahirano commented 9 years ago

Looks good for Request, but how about Response / ResponseInit? I'm a bit confused about the inconsistency of initialization ways between Request and Response. @annevk, can you tell me why?

annevk commented 9 years ago

@yutakahirano well, typically, requests are about URLs and responses are about data. It seemed to make sense to match to make the common case convenient. Open to suggestions.

domenic commented 9 years ago

After thinking about this for a while I can't see a way to make it work great for Response and so I am retracting it. I posted to whatwg@whatwg.org to ask for any other options but unless there is a great idea I am OK with overloading the body option (in both cases) so that when given a function it exposes the writable stream.

https://readable-email.org/list/whatwg/topic/feedback-wanted-on-integrating-fetch-request-response-and-streams