This changes the behavior of Headers regarding handling of headers with multiple values. Most notably, it removes the Headers.getAll() method. This diverges from the native implementations of Chrome and Firefox, since those vendors implement an earlier, now outdated version of the spec. The polyfill now acts more similar to Microsoft Edge implementation.

Consider this Headers object:

var h = new Headers()
h.append('accept', 'text/html')
h.append('accept', 'text/plain')
h.append('content-type', 'application/json')

Before:

  • h.get('accept') returned text/html
  • h.getAll('accept') returned an array of values
  • h.forEach (and other iterables) did distinct iterations for each value of the same header

Now:

  • h.get('accept') returns text/html,text/plain
  • h.getAll() is no more
  • h.forEach() (and other iterables) now only do one iteration for each unique header name, regardless of whether it had multiple values

This is in accordance with Section 3.1.2 of the spec, "combine" concept.

项目简介

A window.fetch JavaScript polyfill.

🚀 Github 镜像仓库 🚀

源项目地址

https://github.com/github/fetch

发行版本 55

v3.6.19

全部发行版

贡献者 81

全部贡献者

开发语言

  • JavaScript 99.5 %
  • Makefile 0.5 %