Socket
Socket
Sign inDemoInstall

nock

Package Overview
Dependencies
Maintainers
4
Versions
429
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nock - npm Package Compare versions

Comparing version 13.3.3 to 13.3.6

6

lib/back.js

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

'Ex:\n' +
"\trequire(nock).back.fixtures = '/path/to/fixtures/'"
"\trequire(nock).back.fixtures = '/path/to/fixtures/'",
)

@@ -304,4 +304,4 @@ }

[].concat(...pending),
fixture
)
fixture,
),
)

@@ -308,0 +308,0 @@ }

'use strict'
const debug = require('debug')('nock.common')
const isPlainObject = require('lodash/isPlainObject')
const set = require('lodash/set')
const timers = require('timers')

@@ -84,3 +82,3 @@ const url = require('url')

throw new Error(
`Module's request already overridden for ${moduleName} protocol.`
`Module's request already overridden for ${moduleName} protocol.`,
)

@@ -130,3 +128,3 @@ }

debug('- restored request for', proto)
}
},
)

@@ -211,7 +209,7 @@ requestOverrides = {}

throw Error(
`Failed to convert header keys to lower case due to field name conflict: ${key}`
`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.`
`Duplicate header provided in request: ${key}. Only the last value can be matched.`,
)

@@ -250,3 +248,3 @@ }

throw new Error(
`Raw headers must be provided as an array with an even number of items. [fieldName, value, ...]`
`Raw headers must be provided as an array with an even number of items. [fieldName, value, ...]`,
)

@@ -267,3 +265,3 @@ }

throw new Error(
`Headers must be provided as an array of raw values, a Map, or a plain Object. ${headers}`
`Headers must be provided as an array of raw values, a Map, or a plain Object. ${headers}`,
)

@@ -577,13 +575,2 @@ }

/**
* Converts flat objects whose keys use JSON path notation to nested objects.
*
* The input object is not mutated.
*
* @example
* { 'foo[bar][0]': 'baz' } -> { foo: { bar: [ 'baz' ] } }
*/
const expand = input =>
Object.entries(input).reduce((acc, [k, v]) => set(acc, k, v), {})
/**
* Performs a recursive strict comparison between two values.

@@ -609,3 +596,3 @@ *

const allKeys = Array.from(
new Set(Object.keys(expected).concat(Object.keys(actual)))
new Set(Object.keys(expected).concat(Object.keys(actual))),
)

@@ -675,2 +662,88 @@

/**
* Returns true if the given value is a plain object and not an Array.
* @param {*} value
* @returns {boolean}
*/
function isPlainObject(value) {
if (typeof value !== 'object' || value === null) return false
if (Object.prototype.toString.call(value) !== '[object Object]') return false
const proto = Object.getPrototypeOf(value)
if (proto === null) return true
const Ctor =
Object.prototype.hasOwnProperty.call(proto, 'constructor') &&
proto.constructor
return (
typeof Ctor === 'function' &&
Ctor instanceof Ctor &&
Function.prototype.call(Ctor) === Function.prototype.call(value)
)
}
const prototypePollutionBlockList = ['__proto__', 'prototype', 'constructor']
const blocklistFilter = function (part) {
return prototypePollutionBlockList.indexOf(part) === -1
}
/**
* Converts flat objects whose keys use JSON path notation to nested objects.
*
* The input object is not mutated.
*
* @example
* { 'foo[bar][0]': 'baz' } -> { foo: { bar: [ 'baz' ] } }
*/
const expand = input => {
if (input === undefined || input === null) {
return input
}
const keys = Object.keys(input)
const result = {}
let resultPtr = result
for (let path of keys) {
const originalPath = path
if (path.indexOf('[') >= 0) {
path = path.replace(/\[/g, '.').replace(/]/g, '')
}
const parts = path.split('.')
const check = parts.filter(blocklistFilter)
if (check.length !== parts.length) {
return undefined
}
resultPtr = result
const lastIndex = parts.length - 1
for (let i = 0; i < parts.length; ++i) {
const part = parts[i]
if (i === lastIndex) {
if (Array.isArray(resultPtr)) {
resultPtr[+part] = input[originalPath]
} else {
resultPtr[part] = input[originalPath]
}
} else {
if (resultPtr[part] === undefined || resultPtr[part] === null) {
const nextPart = parts[i + 1]
if (/^\d+$/.test(nextPart)) {
resultPtr[part] = []
} else {
resultPtr[part] = {}
}
}
resultPtr = resultPtr[part]
}
}
}
return result
}
module.exports = {

@@ -680,2 +753,3 @@ contentEncoding,

deleteHeadersField,
expand,
forEachHeader,

@@ -682,0 +756,0 @@ formatQueryValue,

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

for (const { key, interceptors, allowUnmocked } of Object.values(
allInterceptors
allInterceptors,
)) {

@@ -189,3 +189,3 @@ for (const interceptor of interceptors) {

interceptors.length > 1 ? 's' : ''
})`
})`,
)

@@ -248,3 +248,3 @@ return interceptors

this.emit('error', error)
}.bind(this)
}.bind(this),
)

@@ -278,3 +278,3 @@ }

throw Error(
'Creating a ClientRequest with empty `options` is not supported in Nock'
'Creating a ClientRequest with empty `options` is not supported in Nock',
)

@@ -315,6 +315,6 @@ }

options.host,
options.path
options.path,
)
this.emit('error', error)
}.bind(this)
}.bind(this),
)

@@ -356,3 +356,3 @@ }

const nestedInterceptors = Object.values(allInterceptors).map(
i => i.interceptors
i => i.interceptors,
)

@@ -398,3 +398,3 @@ return [].concat(...nestedInterceptors).map(i => i.scope)

throw Error(
'Making a request with empty `options` is not supported in Nock'
'Making a request with empty `options` is not supported in Nock',
)

@@ -412,6 +412,6 @@ }

const matches = interceptors.some(interceptor =>
interceptor.matchOrigin(options)
interceptor.matchOrigin(options),
)
const allowUnmocked = interceptors.some(
interceptor => interceptor.options.allowUnmocked
interceptor => interceptor.options.allowUnmocked,
)

@@ -418,0 +418,0 @@

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

options.headers || {},
false
false,
),

@@ -93,3 +93,3 @@ }

'authorization',
`Basic ${Buffer.from(options.auth).toString('base64')}`
`Basic ${Buffer.from(options.auth).toString('base64')}`,
)

@@ -302,7 +302,7 @@ }

const requestBodyString = requestBodyBuffer.toString(
requestBodyIsUtf8Representable ? 'utf8' : 'hex'
requestBodyIsUtf8Representable ? 'utf8' : 'hex',
)
const matchedInterceptor = interceptors.find(i =>
i.match(req, options, requestBodyString)
i.match(req, options, requestBodyString),
)

@@ -312,3 +312,3 @@

matchedInterceptor.scope.logger(
'interceptor identified, starting mocking'
'interceptor identified, starting mocking',
)

@@ -336,3 +336,3 @@

const allowUnmocked = interceptors.some(
i => i.matchHostName(options) && i.options.allowUnmocked
i => i.matchHostName(options) && i.options.allowUnmocked,
)

@@ -339,0 +339,0 @@

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

throw Error(
`Non-wildcard URL path strings must begin with a slash (otherwise they won't match anything) (got: ${uri})`
`Non-wildcard URL path strings must begin with a slash (otherwise they won't match anything) (got: ${uri})`,
)

@@ -49,3 +49,3 @@ }

throw new Error(
'The "method" parameter is required for an intercept call.'
'The "method" parameter is required for an intercept call.',
)

@@ -72,6 +72,6 @@ }

scope.scopeOptions.reqheaders || {},
true
true,
)
this.badheaders = common.headersFieldsArrayToLowerCase(
scope.scopeOptions.badheaders || []
scope.scopeOptions.badheaders || [],
)

@@ -124,3 +124,3 @@

throw Error(
'Invalid arguments. When providing a function for the first argument, .reply does not accept other arguments.'
'Invalid arguments. When providing a function for the first argument, .reply does not accept other arguments.',
)

@@ -159,3 +159,3 @@ }

this.headers = common.headersArrayToObject(
this.rawHeaders.concat(this.scope._defaultReplyHeaders)
this.rawHeaders.concat(this.scope._defaultReplyHeaders),
)

@@ -244,3 +244,3 @@

header,
reqHeader
reqHeader,
)

@@ -256,3 +256,3 @@ return false

stringify(options),
stringify(body)
stringify(body),
)

@@ -269,3 +269,3 @@ }

this.scope.logger(
`Method did not match. Request ${method} Interceptor ${this.method}`
`Method did not match. Request ${method} Interceptor ${this.method}`,
)

@@ -297,3 +297,3 @@ return false

const reqHeadersMatch = Object.keys(this.reqheaders).every(key =>
this.reqheaderMatches(options, key)
this.reqheaderMatches(options, key),
)

@@ -311,3 +311,3 @@

this.scope.logger(
'matching failed because Scope.conditionally() did not validate'
'matching failed because Scope.conditionally() did not validate',
)

@@ -318,3 +318,3 @@ return false

const badHeaders = this.badheaders.filter(
header => header in options.headers
header => header in options.headers,
)

@@ -336,3 +336,3 @@

this.scope.logger(
matchQueries ? 'query matching succeeded' : 'query matching failed'
matchQueries ? 'query matching succeeded' : 'query matching failed',
)

@@ -384,3 +384,3 @@

'\n',
body
body,
)

@@ -387,0 +387,0 @@ }

'use strict'
const mapValues = require('lodash/mapValues')
const querystring = require('querystring')

@@ -65,2 +64,10 @@

function mapValues(object, cb) {
const keys = Object.keys(object)
for (const key of keys) {
object[key] = cb(object[key], key, object)
}
return object
}
/**

@@ -67,0 +74,0 @@ * Based on lodash issue discussion

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

throw Error(
'The array returned from the .reply callback contains too many values'
'The array returned from the .reply callback contains too many values',
)

@@ -261,3 +261,3 @@ }

response.rawHeaders.push(
...selectDefaultHeaders(response.rawHeaders, defaultHeaders)
...selectDefaultHeaders(response.rawHeaders, defaultHeaders),
)

@@ -264,0 +264,0 @@

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

dataChunks,
res.headers
res.headers,
)

@@ -124,3 +124,3 @@ options.path = req.path

queryObj[key],
common.percentEncode
common.percentEncode,
)

@@ -373,3 +373,3 @@ encodedQueryObj[formattedPair[0]] = formattedPair[1]

currentRecordingId,
'restoring all the overridden http/https properties'
'restoring all the overridden http/https properties',
)

@@ -376,0 +376,0 @@

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

throw new TypeError(
`Protocol '${u.protocol}' not recognized. This commonly occurs when a hostname and port are included without a protocol, producing a URL that is valid but confusing, and probably not what you want.`
`Protocol '${u.protocol}' not recognized. This commonly occurs when a hostname and port are included without a protocol, producing a URL that is valid but confusing, and probably not what you want.`,
)

@@ -116,3 +116,3 @@ }

this.scopeOptions,
this.urlParts.hostname
this.urlParts.hostname,
)

@@ -140,3 +140,3 @@ }

requestBody,
interceptorOptions
interceptorOptions,
)

@@ -188,3 +188,3 @@

return !persistedAndUsed && !optional
})
}),
)

@@ -211,3 +211,3 @@ }

this.isDone(),
`Mocks not yet satisfied:\n${this.pendingMocks().join('\n')}`
`Mocks not yet satisfied:\n${this.pendingMocks().join('\n')}`,
)

@@ -228,3 +228,3 @@ }

throw Error(
`Nock internal assertion failed: typeof candidate is ${typeof candidate}. If you encounter this error, please report it as a bug.`
`Nock internal assertion failed: typeof candidate is ${typeof candidate}. If you encounter this error, please report it as a bug.`,
)

@@ -243,3 +243,3 @@ }

throw new Error(
'Invalid arguments: filtering path should be a function or a regular expression'
'Invalid arguments: filtering path should be a function or a regular expression',
)

@@ -254,3 +254,3 @@ }

throw new Error(
'Invalid arguments: filtering request body should be a function or a regular expression'
'Invalid arguments: filtering request body should be a function or a regular expression',
)

@@ -337,3 +337,3 @@ }

throw new Error(
'Mismatched port numbers in scope and port properties of nock definition.'
'Mismatched port numbers in scope and port properties of nock definition.',
)

@@ -340,0 +340,0 @@ }

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

return Buffer.from(
(Math.random() * 10000 + Date.now()).toString()
(Math.random() * 10000 + Date.now()).toString(),
).toString('base64')

@@ -80,0 +80,0 @@ }

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

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

@@ -28,3 +28,2 @@ "repository": {

"json-stringify-safe": "^5.0.1",
"lodash": "^4.17.21",
"propagate": "^2.0.0"

@@ -39,3 +38,3 @@ },

"eslint": "^8.8.0",
"eslint-config-prettier": "^8.1.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.0.0-0",

@@ -51,6 +50,6 @@ "eslint-plugin-import": "^2.16.0",

"nyc": "^15.0.0",
"prettier": "2.8.8",
"prettier": "3.0.3",
"proxyquire": "^2.1.0",
"rimraf": "^3.0.0",
"semantic-release": "^21.0.2",
"semantic-release": "^22.0.5",
"sinon": "^15.0.1",

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

@@ -1145,3 +1145,3 @@ # Nock

nock.enableNetConnect(
host => host.includes('amazon.com') || host.includes('github.com')
host => host.includes('amazon.com') || host.includes('github.com'),
)

@@ -1232,3 +1232,3 @@

- `response` - the body of the reply which can be a JSON, string, hex string representing binary buffers or an array of such hex strings (when handling `content-encoded` in reply header)
- `headers` - the headers of the reply
- `rawHeaders` - the headers of the reply which are formatted as a flat array containing header name and header value pairs (e.g. `['accept', 'application/json', 'set-cookie', 'my-cookie=value']`)
- `reqheader` - the headers of the request

@@ -1253,3 +1253,3 @@

return key + ':' + recordedTimestamp
}
},
)

@@ -1473,3 +1473,3 @@ } else {

/(timestamp):([0-9]+)/g,
(match, key, value) => `${key}:${recordedTimestamp}`
(match, key, value) => `${key}:${recordedTimestamp}`,
)

@@ -1631,19 +1631,22 @@ } else {

<table>
<tr>
<td align="center"><a href="http://pgte.me"><img src="https://avatars1.githubusercontent.com/u/47910?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Pedro Teixeira</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=pgte" title="Code">💻</a> <a href="#maintenance-pgte" title="Maintenance">🚧</a></td>
<td align="center"><a href="https://github.com/n30n0v"><img src="https://avatars3.githubusercontent.com/u/10771967?v=4?s=100" width="100px;" alt=""/><br /><sub><b>n30n0v</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=n30n0v" title="Code">💻</a></td>
<td align="center"><a href="https://burntfen.com"><img src="https://avatars3.githubusercontent.com/u/910753?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Richard Littauer</b></sub></a><br /><a href="#maintenance-RichardLitt" title="Maintenance">🚧</a> <a href="https://github.com/nock/nock/commits?author=RichardLitt" title="Code">💻</a> <a href="#blog-RichardLitt" title="Blogposts">📝</a></td>
<td align="center"><a href="http://ianwsperber.com"><img src="https://avatars1.githubusercontent.com/u/3731165?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ian Walker-Sperber</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=ianwsperber" title="Code">💻</a></td>
<td align="center"><a href="http://ilovacha.com"><img src="https://avatars2.githubusercontent.com/u/1505203?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ivan Erceg</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=ierceg" title="Code">💻</a> <a href="#maintenance-ierceg" title="Maintenance">🚧</a></td>
<td align="center"><a href="https://twitter.com/paulmelnikow"><img src="https://avatars2.githubusercontent.com/u/1487036?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Paul Melnikow</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=paulmelnikow" title="Code">💻</a> <a href="#maintenance-paulmelnikow" title="Maintenance">🚧</a></td>
<td align="center"><a href="https://twitter.com/gr2m"><img src="https://avatars3.githubusercontent.com/u/39992?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gregor Martynus</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=gr2m" title="Code">💻</a> <a href="#maintenance-gr2m" title="Maintenance">🚧</a> <a href="#business-gr2m" title="Business development">💼</a> <a href="#financial-gr2m" title="Financial">💵</a> <a href="#blog-gr2m" title="Blogposts">📝</a></td>
</tr>
<tr>
<td align="center"><a href="https://gitlab.com/hutson"><img src="https://avatars1.githubusercontent.com/u/6701030?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hutson Betts</b></sub></a><br /><a href="#financial-hutson" title="Financial">💵</a></td>
<td align="center"><a href="http://lilja.io"><img src="https://avatars2.githubusercontent.com/u/6105119?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jonas Lilja</b></sub></a><br /><a href="#financial-jlilja" title="Financial">💵</a> <a href="https://github.com/nock/nock/commits?author=jlilja" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/benrki"><img src="https://avatars0.githubusercontent.com/u/4446950?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Benjamin Ki</b></sub></a><br /><a href="#financial-benrki" title="Financial">💵</a></td>
<td align="center"><a href="http://chadf.ca"><img src="https://avatars2.githubusercontent.com/u/3250463?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chad Fawcett</b></sub></a><br /><a href="#financial-chadfawcett" title="Financial">💵</a></td>
<td align="center"><a href="http://www.laurencemyers.com.au"><img src="https://avatars.githubusercontent.com/u/6336048?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Laurence Dougal Myers</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=laurence-myers" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/Beretta1979"><img src="https://avatars.githubusercontent.com/u/10073962?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sébastien Van Bruaene</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=Beretta1979" title="Code">💻</a> <a href="https://github.com/nock/nock/commits?author=Beretta1979" title="Tests">⚠️</a></td>
</tr>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://pgte.me"><img src="https://avatars1.githubusercontent.com/u/47910?v=4?s=100" width="100px;" alt="Pedro Teixeira"/><br /><sub><b>Pedro Teixeira</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=pgte" title="Code">💻</a> <a href="#maintenance-pgte" title="Maintenance">🚧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/n30n0v"><img src="https://avatars3.githubusercontent.com/u/10771967?v=4?s=100" width="100px;" alt="n30n0v"/><br /><sub><b>n30n0v</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=n30n0v" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://burntfen.com"><img src="https://avatars3.githubusercontent.com/u/910753?v=4?s=100" width="100px;" alt="Richard Littauer"/><br /><sub><b>Richard Littauer</b></sub></a><br /><a href="#maintenance-RichardLitt" title="Maintenance">🚧</a> <a href="https://github.com/nock/nock/commits?author=RichardLitt" title="Code">💻</a> <a href="#blog-RichardLitt" title="Blogposts">📝</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://ianwsperber.com"><img src="https://avatars1.githubusercontent.com/u/3731165?v=4?s=100" width="100px;" alt="Ian Walker-Sperber"/><br /><sub><b>Ian Walker-Sperber</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=ianwsperber" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://ilovacha.com"><img src="https://avatars2.githubusercontent.com/u/1505203?v=4?s=100" width="100px;" alt="Ivan Erceg"/><br /><sub><b>Ivan Erceg</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=ierceg" title="Code">💻</a> <a href="#maintenance-ierceg" title="Maintenance">🚧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://twitter.com/paulmelnikow"><img src="https://avatars2.githubusercontent.com/u/1487036?v=4?s=100" width="100px;" alt="Paul Melnikow"/><br /><sub><b>Paul Melnikow</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=paulmelnikow" title="Code">💻</a> <a href="#maintenance-paulmelnikow" title="Maintenance">🚧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://twitter.com/gr2m"><img src="https://avatars3.githubusercontent.com/u/39992?v=4?s=100" width="100px;" alt="Gregor Martynus"/><br /><sub><b>Gregor Martynus</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=gr2m" title="Code">💻</a> <a href="#maintenance-gr2m" title="Maintenance">🚧</a> <a href="#business-gr2m" title="Business development">💼</a> <a href="#financial-gr2m" title="Financial">💵</a> <a href="#blog-gr2m" title="Blogposts">📝</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://gitlab.com/hutson"><img src="https://avatars1.githubusercontent.com/u/6701030?v=4?s=100" width="100px;" alt="Hutson Betts"/><br /><sub><b>Hutson Betts</b></sub></a><br /><a href="#financial-hutson" title="Financial">💵</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://lilja.io"><img src="https://avatars2.githubusercontent.com/u/6105119?v=4?s=100" width="100px;" alt="Jonas Lilja"/><br /><sub><b>Jonas Lilja</b></sub></a><br /><a href="#financial-jlilja" title="Financial">💵</a> <a href="https://github.com/nock/nock/commits?author=jlilja" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/benrki"><img src="https://avatars0.githubusercontent.com/u/4446950?v=4?s=100" width="100px;" alt="Benjamin Ki"/><br /><sub><b>Benjamin Ki</b></sub></a><br /><a href="#financial-benrki" title="Financial">💵</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://chadf.ca"><img src="https://avatars2.githubusercontent.com/u/3250463?v=4?s=100" width="100px;" alt="Chad Fawcett"/><br /><sub><b>Chad Fawcett</b></sub></a><br /><a href="#financial-chadfawcett" title="Financial">💵</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.laurencemyers.com.au"><img src="https://avatars.githubusercontent.com/u/6336048?v=4?s=100" width="100px;" alt="Laurence Dougal Myers"/><br /><sub><b>Laurence Dougal Myers</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=laurence-myers" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Beretta1979"><img src="https://avatars.githubusercontent.com/u/10073962?v=4?s=100" width="100px;" alt="Sébastien Van Bruaene"/><br /><sub><b>Sébastien Van Bruaene</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=Beretta1979" title="Code">💻</a> <a href="https://github.com/nock/nock/commits?author=Beretta1979" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Uzlopak"><img src="https://avatars.githubusercontent.com/u/5059100?v=4?s=100" width="100px;" alt="Aras Abbasi"/><br /><sub><b>Aras Abbasi</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=Uzlopak" title="Code">💻</a> <a href="https://github.com/nock/nock/commits?author=Uzlopak" title="Tests">⚠️</a> <a href="#maintenance-Uzlopak" title="Maintenance">🚧</a></td>
</tr>
</tbody>
</table>

@@ -1650,0 +1653,0 @@

@@ -11,4 +11,4 @@ // TypeScript Version: 3.5

declare function nock(
basePath: string | RegExp | Url,
options?: nock.Options
basePath: string | RegExp | Url | URL,
options?: nock.Options,
): nock.Scope

@@ -26,3 +26,3 @@

function enableNetConnect(
matcher?: string | RegExp | ((host: string) => boolean)
matcher?: string | RegExp | ((host: string) => boolean),
): void

@@ -42,3 +42,3 @@ function load(path: string): Scope[]

requestBody?: RequestBodyMatcher,
interceptorOptions?: Options
interceptorOptions?: Options,
) => Interceptor

@@ -82,3 +82,3 @@

res: IncomingMessage,
body: string | Buffer
body: string | Buffer,
) => string | string[]

@@ -117,3 +117,3 @@ type ReplyHeaderValue = string | string[] | ReplyHeaderFunction

requestBody?: RequestBodyMatcher,
options?: Options
options?: Options,
) => Interceptor

@@ -145,3 +145,3 @@

| URLSearchParams
| { (parsedObj: ParsedUrlQuery): boolean }
| { (parsedObj: ParsedUrlQuery): boolean },
): this

@@ -160,5 +160,5 @@

err: NodeJS.ErrnoException | null,
result: ReplyFnResult
) => void
) => void
result: ReplyFnResult,
) => void,
) => void,
): Scope

@@ -169,4 +169,4 @@ reply(

uri: string,
body: Body
) => ReplyFnResult | Promise<ReplyFnResult>
body: Body,
) => ReplyFnResult | Promise<ReplyFnResult>,
): Scope

@@ -179,5 +179,8 @@ reply(

body: Body,
callback: (err: NodeJS.ErrnoException | null, result: ReplyBody) => void
callback: (
err: NodeJS.ErrnoException | null,
result: ReplyBody,
) => void,
) => void,
headers?: ReplyHeaders
headers?: ReplyHeaders,
): Scope

@@ -189,5 +192,5 @@ reply(

uri: string,
body: Body
body: Body,
) => ReplyBody | Promise<ReplyBody>,
headers?: ReplyHeaders
headers?: ReplyHeaders,
): Scope

@@ -201,3 +204,3 @@ reply(responseCode?: StatusCode, body?: Body, headers?: ReplyHeaders): Scope

fileName: string,
headers?: ReplyHeaders
headers?: ReplyHeaders,
): Scope

@@ -265,5 +268,8 @@

options: BackOptions,
nockedFn: (nockDone: () => void) => void
nockedFn: (nockDone: () => void) => void,
): void
(fixtureName: string, options?: BackOptions): Promise<{
(
fixtureName: string,
options?: BackOptions,
): Promise<{
nockDone: () => void

@@ -270,0 +276,0 @@ context: BackContext

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