@whatwg-node/node-fetch 0.7.20-alpha-20250515123636-b0cbb054c56426df02d3bf080f670444c6e02bbd → 0.7.20-alpha-20250515123934-037460f929f788c2d3902d4d68aca61757f84761

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/Headers.js CHANGED
@@ -146,11 +146,25 @@ class PonyfillHeaders {
146
146
  this._map.set(key, value);
147
147
  return;
148
148
  }
149
- if (this.headersInit != null &&
150
- !isHeadersLike(this.headersInit) &&
151
- !Array.isArray(this.headersInit)) {
152
- this.headersInit[key] = value;
153
- return;
149
+ if (this.headersInit != null) {
150
+ if (Array.isArray(this.headersInit)) {
151
+ const found = this.headersInit.find(([headerKey]) => headerKey.toLowerCase() === key);
152
+ if (found) {
153
+ found[1] = value;
154
+ }
155
+ else {
156
+ this.headersInit.push([key, value]);
157
+ }
158
+ return;
159
+ }
160
+ else if (isHeadersLike(this.headersInit)) {
161
+ this.headersInit.set(key, value);
162
+ return;
163
+ }
164
+ else {
165
+ this.headersInit[key] = value;
166
+ return;
167
+ }
154
168
  }
155
169
  this.getMap().set(key, value);
156
170
  }
package/esm/Headers.js CHANGED
@@ -142,11 +142,25 @@ export class PonyfillHeaders {
142
142
  this._map.set(key, value);
143
143
  return;
144
144
  }
145
- if (this.headersInit != null &&
146
- !isHeadersLike(this.headersInit) &&
147
- !Array.isArray(this.headersInit)) {
148
- this.headersInit[key] = value;
149
- return;
145
+ if (this.headersInit != null) {
146
+ if (Array.isArray(this.headersInit)) {
147
+ const found = this.headersInit.find(([headerKey]) => headerKey.toLowerCase() === key);
148
+ if (found) {
149
+ found[1] = value;
150
+ }
151
+ else {
152
+ this.headersInit.push([key, value]);
153
+ }
154
+ return;
155
+ }
156
+ else if (isHeadersLike(this.headersInit)) {
157
+ this.headersInit.set(key, value);
158
+ return;
159
+ }
160
+ else {
161
+ this.headersInit[key] = value;
162
+ return;
163
+ }
150
164
  }
151
165
  this.getMap().set(key, value);
152
166
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.7.20-alpha-20250515123636-b0cbb054c56426df02d3bf080f670444c6e02bbd",
3
+ "version": "0.7.20-alpha-20250515123934-037460f929f788c2d3902d4d68aca61757f84761",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {