Comparing version 5.1.0 to 5.1.1
@@ -34,2 +34,22 @@ 'use strict' | ||
/** | ||
* @param {import('../../index').Headers|string[]|Record<string, string>} headers | ||
* @param {string} key | ||
*/ | ||
function getHeaderByName (headers, key) { | ||
if (Array.isArray(headers)) { | ||
for (let i = 0; i < headers.length; i += 2) { | ||
if (headers[i] === key) { | ||
return headers[i + 1] | ||
} | ||
} | ||
return undefined | ||
} else if (typeof headers.get === 'function') { | ||
return headers.get(key) | ||
} else { | ||
return headers[key] | ||
} | ||
} | ||
function matchHeaders (mockDispatch, headers) { | ||
@@ -55,5 +75,5 @@ if (typeof mockDispatch.headers === 'function') { | ||
for (const [matchHeaderName, matchHeaderValue] of Object.entries(mockDispatch.headers)) { | ||
const header = typeof headers.get === 'function' ? headers.get(matchHeaderName) : headers[matchHeaderName] | ||
const headerValue = getHeaderByName(headers, matchHeaderName) | ||
if (!matchValue(matchHeaderValue, header)) { | ||
if (!matchValue(matchHeaderValue, headerValue)) { | ||
return false | ||
@@ -342,3 +362,4 @@ } | ||
checkNetConnect, | ||
buildMockOptions | ||
buildMockOptions, | ||
getHeaderByName | ||
} |
{ | ||
"name": "undici", | ||
"version": "5.1.0", | ||
"version": "5.1.1", | ||
"description": "An HTTP/1.1 client, written from scratch for Node.js", | ||
@@ -38,2 +38,3 @@ "homepage": "https://undici.nodejs.org", | ||
"index.js", | ||
"index-fetch.js", | ||
"lib", | ||
@@ -40,0 +41,0 @@ "types", |
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
815985
101
11876