Re: [whatwg/fetch] Get multiple headers as an aray rather than a combined value? (#506)

> > Actually, it looks like a for/of loop gets each header individually
> 
> That would be a bug in whatever browser you're testing. Can you let us know which one that is so we can file an issue and write tests to get it fixed?

This is in Firefox 52, although it apparently only works when I create the Headers object myself. Ones from the server concatenate the string even in for/of loops, as does chrome. (For headers they allow, such as `X-Foo`. No browser gives access to `Set-Cookie` headers, although apparently the `fetch` implementation in React Native does.)

To clarify, this code logs two entries in Firefox but only one in Chrome:
```js
headers = new Headers([['X-Foo', 'a=b, and c'],['X-Foo',' d=e']])
for(let header of headers) {
  console.log(header);
}
```
http://jsbin.com/gevixekimo/edit?js,console

I closed this thinking that the Firefox behavior would be everywhere. Reading the spec more thoroughly, I see that it prescribes the Chrome behavior. In my opinion the Firefox version is the more useful behavior and the spec should be changed to match it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/506#issuecomment-286452818

Received on Tuesday, 14 March 2017 15:14:38 UTC