Socket
Socket
Sign inDemoInstall

nock

Package Overview
Dependencies
5
Maintainers
4
Versions
422
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 13.2.1 to 13.2.2

14

lib/common.js

@@ -197,3 +197,3 @@ 'use strict'

*/
function headersFieldNamesToLowerCase(headers) {
function headersFieldNamesToLowerCase(headers, throwOnDuplicate) {
if (!isPlainObject(headers)) {

@@ -207,5 +207,11 @@ throw Error('Headers must be provided as an object')

if (lowerCaseHeaders[key] !== undefined) {
throw Error(
`Failed to convert header keys to lower case due to field name conflict: ${key}`
)
if (throwOnDuplicate) {
throw Error(
`Failed to convert header keys to lower case due to field name conflict: ${key}`
)
} else {
debug(
`Duplicate header provided in request: ${key}. Only the last value can be matched.`
)
}
}

@@ -212,0 +218,0 @@ lowerCaseHeaders[key] = fieldValue

@@ -43,3 +43,6 @@ 'use strict'

// We use lower-case header field names throughout Nock.
headers: common.headersFieldNamesToLowerCase(options.headers || {}),
headers: common.headersFieldNamesToLowerCase(
options.headers || {},
false
),
}

@@ -46,0 +49,0 @@ this.interceptors = interceptors

@@ -69,3 +69,4 @@ 'use strict'

this.reqheaders = common.headersFieldNamesToLowerCase(
scope.scopeOptions.reqheaders || {}
scope.scopeOptions.reqheaders || {},
true
)

@@ -416,2 +417,8 @@ this.badheaders = common.headersFieldsArrayToLowerCase(

matchHostName(options) {
const { basePath } = this.scope
if (basePath instanceof RegExp) {
return basePath.test(options.hostname)
}
return options.hostname === this.scope.urlParts.hostname

@@ -418,0 +425,0 @@ }

@@ -171,3 +171,3 @@ 'use strict'

enable_reqheaders_recording: false,
logging: console.log,
logging: console.log, // eslint-disable-line no-console
output_objects: false,

@@ -174,0 +174,0 @@ use_separator: true,

@@ -10,3 +10,3 @@ {

],
"version": "13.2.1",
"version": "13.2.2",
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>",

@@ -41,15 +41,15 @@ "repository": {

"eslint-plugin-import": "^2.16.0",
"eslint-plugin-mocha": "^9.0.0",
"eslint-plugin-mocha": "^10.0.3",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-standard": "^5.0.0",
"form-data": "^4.0.0",
"got": "^11.3.0",
"mocha": "^8.0.1",
"mocha": "^9.1.3",
"npm-run-all": "^4.1.5",
"nyc": "^15.0.0",
"prettier": "2.4.1",
"prettier": "2.5.1",
"proxyquire": "^2.1.0",
"rimraf": "^3.0.0",
"semantic-release": "^17.0.2",
"semantic-release": "^18.0.1",
"sinon": "^12.0.1",

@@ -56,0 +56,0 @@ "sinon-chai": "^3.7.0",

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc