Socket
Socket
Sign inDemoInstall

undici

Package Overview
Dependencies
Maintainers
3
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

undici - npm Package Compare versions

Comparing version 5.1.0 to 5.1.1

index-fetch.js

27

lib/mock/mock-utils.js

@@ -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
}

3

package.json
{
"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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc