{"action":"created","issue":{"url":"https://api.github.com/repos/github/fetch/issues/292","repository_url":"https://api.github.com/repos/github/fetch","labels_url":"https://api.github.com/repos/github/fetch/issues/292/labels{/name}","comments_url":"https://api.github.com/repos/github/fetch/issues/292/comments","events_url":"https://api.github.com/repos/github/fetch/issues/292/events","html_url":"https://github.com/github/fetch/issues/292","id":139830467,"number":292,"title":"Getting all headers, mismatch between the specs and polyfill and implementations","user":{"login":"lukeapage","id":309321,"avatar_url":"https://avatars.githubusercontent.com/u/309321?v=3","gravatar_id":"","url":"https://api.github.com/users/lukeapage","html_url":"https://github.com/lukeapage","followers_url":"https://api.github.com/users/lukeapage/followers","following_url":"https://api.github.com/users/lukeapage/following{/other_user}","gists_url":"https://api.github.com/users/lukeapage/gists{/gist_id}","starred_url":"https://api.github.com/users/lukeapage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukeapage/subscriptions","organizations_url":"https://api.github.com/users/lukeapage/orgs","repos_url":"https://api.github.com/users/lukeapage/repos","events_url":"https://api.github.com/users/lukeapage/events{/privacy}","received_events_url":"https://api.github.com/users/lukeapage/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-10T09:19:49Z","updated_at":"2016-03-11T20:34:22Z","closed_at":"2016-03-11T17:41:48Z","body":"So MDN says to use\r\n```\r\nheaders.entries();\r\n```\r\nthe fetch spec says the Headers object is iterable itself (so it should have a `Symbol.iterator` function)\r\n\r\nand then the polyfill has `forEach`\r\n\r\nLooking at chromes fetch we have\r\n\r\n![image](https://cloud.githubusercontent.com/assets/309321/13664673/f62b211e-e6a8-11e5-879d-f253db804b2b.png)\r\n\r\nand firefox has\r\n\r\n![image](https://cloud.githubusercontent.com/assets/309321/13664784/79bec22e-e6a9-11e5-93ab-7ec54463512b.png)\r\n\r\nso I guess to be forwards compatible I have to try to use forEach and fall-back to either an iterator on headers itself or entries..\r\n\r\nShould an iterator be added and forEach removed so that people donm't think that forEach is guarenteed to be present when not polyfilled?\r\n\r\n[Edited to be more correct about iterator on headers directly]"},"comment":{"url":"https://api.github.com/repos/github/fetch/issues/comments/195539512","html_url":"https://github.com/github/fetch/issues/292#issuecomment-195539512","issue_url":"https://api.github.com/repos/github/fetch/issues/292","id":195539512,"user":{"login":"dkfiresky","id":2175645,"avatar_url":"https://avatars.githubusercontent.com/u/2175645?v=3","gravatar_id":"","url":"https://api.github.com/users/dkfiresky","html_url":"https://github.com/dkfiresky","followers_url":"https://api.github.com/users/dkfiresky/followers","following_url":"https://api.github.com/users/dkfiresky/following{/other_user}","gists_url":"https://api.github.com/users/dkfiresky/gists{/gist_id}","starred_url":"https://api.github.com/users/dkfiresky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkfiresky/subscriptions","organizations_url":"https://api.github.com/users/dkfiresky/orgs","repos_url":"https://api.github.com/users/dkfiresky/repos","events_url":"https://api.github.com/users/dkfiresky/events{/privacy}","received_events_url":"https://api.github.com/users/dkfiresky/received_events","type":"User","site_admin":false},"created_at":"2016-03-11T20:34:22Z","updated_at":"2016-03-11T20:34:22Z","body":"> Once `Headers.prototype[Symbol.iterator]` is defined this special casing will no longer be needed.\r\n\r\n`Symbol.Iterator` is optional as default behavior described:\r\n\r\n> If object is a Headers object, copy its header list as headerListCopy and then for each header in headerListCopy, retaining order, append header's name/header's value to headers. Rethrow any exception."}}