RE: Fetch API

Overall it looks really solid. Only a few things I could think of:

- 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.

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

- 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"
  }
});

instead of, assuming a constructor is added,

fetch("http://example.com", {
  headers: new HeaderMap([
    ["X-Foo", "Bar"]
  ])
});

-----Original Message-----
From: annevankesteren@gmail.com [mailto:annevankesteren@gmail.com] On Behalf Of Anne van Kesteren
Sent: Thursday, May 29, 2014 08:57
To: public-script-coord; Joshua Bell; Jungkee Song; Yehuda Katz; Alex Russell; Jonas Sicking; Jake Archibald; Tobie Langel
Cc: WebApps WG
Subject: Fetch API

The plan is to implement and ship this fairly soon, so I figured I'd ask for review now, while we're still drafting the text:

http://fetch.spec.whatwg.org/#fetch-api


In particular I'd like feedback on the design of Request and Response classes, and the fetch() method.


--
http://annevankesteren.nl/

Received on Sunday, 1 June 2014 06:07:28 UTC