-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Hi this is the cross-fetch author. In order to keep maximum consistency between node-fetch, whatwg-fetch and native browser fetch, I'm running the same suite of tests across all these implementations. For the 3.0.0-beta.9 version, there are only two issues with Headers' forEach method that differs from browsers' fetch and whatwg-fetch:
- It does not accept
thisArgas the second parameter - The callback does not provide a third argument: the header object itself.
Here's a code to illustrate that:
const headers = new Headers()
headers.append('Accept', 'application/json')
const obj = {}
const results = []
headers.forEach(function (value, key, object) {
results.push({ value, key, object, thisArg: this })
}, obj);
console.log(results[0].object === headers) // true on browser, false on node-fetch 3.0.0-beta.9
console.log(results[0].thisArg === obj) // true on browser, false on node-fetch 3.0.0-beta.9I realize that on version 2.6.1, it used to have both features. So my question: is this intentional? If not, does anyone mind if I open a PR?
Metadata
Metadata
Assignees
Labels
No labels