@whatwg-node/node-fetch 0.7.10-alpha-20250220111507-a3545bc54346479a467fb28e29d6484542def7a0 → 0.7.10-alpha-20250220121345-559e23af1fee012d82a99600f796c28c8c111318
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 +16 -6
- package/esm/Headers.js +16 -6
- package/package.json +1 -1
package/cjs/Headers.js
CHANGED
@@ -31,7 +31,14 @@ class PonyfillHeaders {
|
|
31
31
|
return null;
|
32
32
|
}
|
33
33
|
if (Array.isArray(this.headersInit)) {
|
34
|
-
|
34
|
+
const found = this.headersInit.filter(([headerKey]) => headerKey.toLowerCase() === normalized);
|
35
|
+
if (found.length === 0) {
|
36
|
+
return null;
|
37
|
+
}
|
38
|
+
if (found.length === 1) {
|
39
|
+
return found[0][1];
|
40
|
+
}
|
41
|
+
return found.map(([, value]) => value).join(', ');
|
35
42
|
}
|
36
43
|
else if (isHeadersLike(this.headersInit)) {
|
37
44
|
return this.headersInit.get(normalized);
|
@@ -59,18 +66,18 @@ class PonyfillHeaders {
|
|
59
66
|
// I could do a getter here, but I'm too lazy to type `getter`.
|
60
67
|
getMap() {
|
61
68
|
if (!this._map) {
|
69
|
+
this._setCookies = [];
|
62
70
|
if (this.headersInit != null) {
|
63
71
|
if (Array.isArray(this.headersInit)) {
|
64
72
|
this._map = new Map();
|
65
|
-
|
73
|
+
for (const [key, value] of this.headersInit) {
|
66
74
|
const normalizedKey = key.toLowerCase();
|
67
75
|
if (normalizedKey === 'set-cookie') {
|
68
|
-
this._setCookies ||= [];
|
69
76
|
this._setCookies.push(value);
|
70
|
-
|
77
|
+
continue;
|
71
78
|
}
|
72
79
|
this._map.set(normalizedKey, value);
|
73
|
-
}
|
80
|
+
}
|
74
81
|
}
|
75
82
|
else if (isHeadersLike(this.headersInit)) {
|
76
83
|
this._map = new Map();
|
@@ -243,7 +250,10 @@ class PonyfillHeaders {
|
|
243
250
|
return new IteratorObject_js_1.PonyfillIteratorObject(this._entries(), 'HeadersIterator');
|
244
251
|
}
|
245
252
|
getSetCookie() {
|
246
|
-
|
253
|
+
if (!this._setCookies) {
|
254
|
+
this.getMap();
|
255
|
+
}
|
256
|
+
return this._setCookies;
|
247
257
|
}
|
248
258
|
[Symbol.iterator]() {
|
249
259
|
return this.entries();
|
package/esm/Headers.js
CHANGED
@@ -27,7 +27,14 @@ export class PonyfillHeaders {
|
|
27
27
|
return null;
|
28
28
|
}
|
29
29
|
if (Array.isArray(this.headersInit)) {
|
30
|
-
|
30
|
+
const found = this.headersInit.filter(([headerKey]) => headerKey.toLowerCase() === normalized);
|
31
|
+
if (found.length === 0) {
|
32
|
+
return null;
|
33
|
+
}
|
34
|
+
if (found.length === 1) {
|
35
|
+
return found[0][1];
|
36
|
+
}
|
37
|
+
return found.map(([, value]) => value).join(', ');
|
31
38
|
}
|
32
39
|
else if (isHeadersLike(this.headersInit)) {
|
33
40
|
return this.headersInit.get(normalized);
|
@@ -55,18 +62,18 @@ export class PonyfillHeaders {
|
|
55
62
|
// I could do a getter here, but I'm too lazy to type `getter`.
|
56
63
|
getMap() {
|
57
64
|
if (!this._map) {
|
65
|
+
this._setCookies = [];
|
58
66
|
if (this.headersInit != null) {
|
59
67
|
if (Array.isArray(this.headersInit)) {
|
60
68
|
this._map = new Map();
|
61
|
-
|
69
|
+
for (const [key, value] of this.headersInit) {
|
62
70
|
const normalizedKey = key.toLowerCase();
|
63
71
|
if (normalizedKey === 'set-cookie') {
|
64
|
-
this._setCookies ||= [];
|
65
72
|
this._setCookies.push(value);
|
66
|
-
|
73
|
+
continue;
|
67
74
|
}
|
68
75
|
this._map.set(normalizedKey, value);
|
69
|
-
}
|
76
|
+
}
|
70
77
|
}
|
71
78
|
else if (isHeadersLike(this.headersInit)) {
|
72
79
|
this._map = new Map();
|
@@ -239,7 +246,10 @@ export class PonyfillHeaders {
|
|
239
246
|
return new PonyfillIteratorObject(this._entries(), 'HeadersIterator');
|
240
247
|
}
|
241
248
|
getSetCookie() {
|
242
|
-
|
249
|
+
if (!this._setCookies) {
|
250
|
+
this.getMap();
|
251
|
+
}
|
252
|
+
return this._setCookies;
|
243
253
|
}
|
244
254
|
[Symbol.iterator]() {
|
245
255
|
return this.entries();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@whatwg-node/node-fetch",
|
3
|
-
"version": "0.7.10-alpha-
|
3
|
+
"version": "0.7.10-alpha-20250220121345-559e23af1fee012d82a99600f796c28c8c111318",
|
4
4
|
"description": "Fetch API implementation for Node",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|