@whatwg-node/node-fetch
Advanced tools
Comparing version 0.0.5 to 0.0.6-alpha-20230207082303-4613c8e
28
index.js
@@ -716,2 +716,5 @@ 'use strict'; | ||
function isHeadersLike(headers) { | ||
return headers && typeof headers.get === 'function'; | ||
} | ||
class PonyfillHeaders { | ||
@@ -722,16 +725,7 @@ constructor(headersInit) { | ||
if (Array.isArray(headersInit)) { | ||
for (const [key, value] of headersInit) { | ||
if (Array.isArray(value)) { | ||
for (const v of value) { | ||
this.append(key, v); | ||
} | ||
} | ||
else { | ||
this.map.set(key, value); | ||
} | ||
} | ||
this.map = new Map(headersInit); | ||
} | ||
else if ('get' in headersInit) { | ||
else if (isHeadersLike(headersInit)) { | ||
headersInit.forEach((value, key) => { | ||
this.append(key, value); | ||
this.map.set(key, value); | ||
}); | ||
@@ -742,10 +736,6 @@ } | ||
const value = headersInit[key]; | ||
if (Array.isArray(value)) { | ||
for (const v of value) { | ||
this.append(key, v); | ||
} | ||
if (value != null) { | ||
const normalizedValue = Array.isArray(value) ? value.join(', ') : value; | ||
this.map.set(key, normalizedValue); | ||
} | ||
else if (value != null) { | ||
this.set(key, value); | ||
} | ||
} | ||
@@ -752,0 +742,0 @@ } |
{ | ||
"name": "@whatwg-node/node-fetch", | ||
"version": "0.0.5", | ||
"version": "0.0.6-alpha-20230207082303-4613c8e", | ||
"description": "Fetch API implementation for Node", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86431
2318