- From: Jonas Sicking <jonas@sicking.cc>
- Date: Tue, 3 Jun 2014 12:00:16 -0700
- To: Jake Archibald <jaffathecake@gmail.com>
- Cc: Anne van Kesteren <annevk@annevk.nl>, Domenic Denicola <domenic@domenicdenicola.com>, public-script-coord <public-script-coord@w3.org>, Joshua Bell <jsbell@chromium.org>, Jungkee Song <jungkee.song@samsung.com>, Yehuda Katz <wycats@gmail.com>, Alex Russell <slightlyoff@google.com>, Tobie Langel <tobie.langel@gmail.com>, WebApps WG <public-webapps@w3.org>
On Tue, Jun 3, 2014 at 9:38 AM, Jake Archibald <jaffathecake@gmail.com> wrote: > On 3 June 2014 16:50, Anne van Kesteren <annevk@annevk.nl> wrote: >> >> On Sun, Jun 1, 2014 at 8:06 AM, Domenic Denicola >> <domenic@domenicdenicola.com> wrote: >> >> > - 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"] >> > ]) >> > }); >> >> Yeah, it's not clear to me what is best here. An object whose keys are >> ByteString and values are either ByteString or a sequence of >> ByteString? I agree that we want this. > > I vote ByteString: ByteString. If you want something more complicated, > provide a HeaderMap or mutate after construction. One thing we should keep in mind is if we actually need to support 100% of all the crazyness that servers do. And especially if we need to support it in a particularly convenient way. Something like headers: { "X-Foo": "Bar" } Does actually have a defined order between the name-value pairs, even though it's not terribly explicit. And we could even support headers: { "X-Foo": ["Bar", "Bar2"] } For supporting sending multiple "X-Foo" headers. This wouldn't support interleaving headers such that we send two "X-Foo" headers with a "X-Bar" header in between, but are there actually use cases for that? I feel fairly sure that simply doing: headers: { "X-Foo": ["Bar", "Bar2"] } Will cover well over 99% of everything that people need to do. And hopefully the remaining part of a percent could update their servers to actually support HTTP semantics properly. / Jonas
Received on Tuesday, 3 June 2014 19:01:14 UTC