Re: Fetch API

On 6/1/14, 2:06 AM, Domenic Denicola wrote:
> - Named constructors scare me (I can't figure out how to make them work in JavaScript without breaking at least one of the normal invariants). I think a static factory method would make more sense for RedirectResponse.

Or just a constructor overload, if the type of "body" for the existing 
constructor can be told apart from a string.  Which may not be the case, 
of course.

> - HeaderMap should have a constructor that takes an iterable of [key, value] pairs, in the same way Map does.

So a sequence<sequence<ByteString>> basically, right?  Seems pretty 
plausible to me.

> - I like HeaderMap a lot, but for construction purposes, I wonder if a shorthand for the usual case could be provided. E.g. it would be nice to be able to do
>
> fetch("http://example.com", {
>    headers: {
>      "X-Foo": "Bar"

We've had other cases arise where such an "open-ended dictionary" 
construct would be useful.  The only difference is that those other 
cases wanted string-valued keys while this might want ByteString-valued 
ones...

One concern here: is order an issue for headers?  I seem to vaguely 
recall that in practice order can matter with some HTTP servers.

-Boris

P.S.  Still reading through; will have feedback of my own in the next 
few days.

Received on Sunday, 1 June 2014 18:14:09 UTC