@whatwg-node/node-fetch 0.8.0 → 0.8.1-alpha-20250930172423-2ff49793ae0584cbb293bfe85f0ad0b331c2537f

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
@@ -73,7 +73,12 @@ class PonyfillHeaders {
73
73
  for (const [key, value] of this.headersInit) {
74
74
  const normalizedKey = key.toLowerCase();
75
75
  if (normalizedKey === 'set-cookie') {
76
- this._setCookies.push(value);
76
+ if (Array.isArray(value)) {
77
+ this._setCookies.push(...value);
78
+ }
79
+ else if (value != null) {
80
+ this._setCookies.push(value);
81
+ }
77
82
  continue;
78
83
  }
79
84
  this._map.set(normalizedKey, value);
@@ -84,7 +89,12 @@ class PonyfillHeaders {
84
89
  this.headersInit.forEach((value, key) => {
85
90
  if (key === 'set-cookie') {
86
91
  this._setCookies ||= [];
87
- this._setCookies.push(value);
92
+ if (Array.isArray(value)) {
93
+ this._setCookies.push(...value);
94
+ }
95
+ else if (value != null) {
96
+ this._setCookies.push(value);
97
+ }
88
98
  return;
89
99
  }
90
100
  this._map.set(key, value);
@@ -98,6 +108,10 @@ class PonyfillHeaders {
98
108
  const normalizedKey = initKey.toLowerCase();
99
109
  if (normalizedKey === 'set-cookie') {
100
110
  this._setCookies ||= [];
111
+ if (Array.isArray(initValue)) {
112
+ this._setCookies.push(...initValue);
113
+ continue;
114
+ }
101
115
  this._setCookies.push(initValue);
102
116
  continue;
103
117
  }
package/esm/Headers.js CHANGED
@@ -69,7 +69,12 @@ export class PonyfillHeaders {
69
69
  for (const [key, value] of this.headersInit) {
70
70
  const normalizedKey = key.toLowerCase();
71
71
  if (normalizedKey === 'set-cookie') {
72
- this._setCookies.push(value);
72
+ if (Array.isArray(value)) {
73
+ this._setCookies.push(...value);
74
+ }
75
+ else if (value != null) {
76
+ this._setCookies.push(value);
77
+ }
73
78
  continue;
74
79
  }
75
80
  this._map.set(normalizedKey, value);
@@ -80,7 +85,12 @@ export class PonyfillHeaders {
80
85
  this.headersInit.forEach((value, key) => {
81
86
  if (key === 'set-cookie') {
82
87
  this._setCookies ||= [];
83
- this._setCookies.push(value);
88
+ if (Array.isArray(value)) {
89
+ this._setCookies.push(...value);
90
+ }
91
+ else if (value != null) {
92
+ this._setCookies.push(value);
93
+ }
84
94
  return;
85
95
  }
86
96
  this._map.set(key, value);
@@ -94,6 +104,10 @@ export class PonyfillHeaders {
94
104
  const normalizedKey = initKey.toLowerCase();
95
105
  if (normalizedKey === 'set-cookie') {
96
106
  this._setCookies ||= [];
107
+ if (Array.isArray(initValue)) {
108
+ this._setCookies.push(...initValue);
109
+ continue;
110
+ }
97
111
  this._setCookies.push(initValue);
98
112
  continue;
99
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.8.0",
3
+ "version": "0.8.1-alpha-20250930172423-2ff49793ae0584cbb293bfe85f0ad0b331c2537f",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {