Update checked-in dependencies
This commit is contained in:
parent
4fad06f438
commit
40a500c743
4168 changed files with 298222 additions and 374905 deletions
29
node_modules/nock/lib/interceptor.js
generated
vendored
29
node_modules/nock/lib/interceptor.js
generated
vendored
|
|
@ -66,7 +66,8 @@ module.exports = class Interceptor {
|
|||
|
||||
// We use lower-case header field names throughout Nock.
|
||||
this.reqheaders = common.headersFieldNamesToLowerCase(
|
||||
scope.scopeOptions.reqheaders || {}
|
||||
scope.scopeOptions.reqheaders || {},
|
||||
true
|
||||
)
|
||||
this.badheaders = common.headersFieldsArrayToLowerCase(
|
||||
scope.scopeOptions.badheaders || []
|
||||
|
|
@ -155,7 +156,7 @@ module.exports = class Interceptor {
|
|||
)
|
||||
|
||||
// If the content is not encoded we may need to transform the response body.
|
||||
// Otherwise we leave it as it is.
|
||||
// Otherwise, we leave it as it is.
|
||||
if (
|
||||
body &&
|
||||
typeof body !== 'string' &&
|
||||
|
|
@ -173,10 +174,14 @@ module.exports = class Interceptor {
|
|||
// https://tools.ietf.org/html/rfc7231#section-3.1.1.5
|
||||
this.rawHeaders.push('Content-Type', 'application/json')
|
||||
}
|
||||
}
|
||||
|
||||
if (this.scope.contentLen) {
|
||||
// https://tools.ietf.org/html/rfc7230#section-3.3.2
|
||||
if (this.scope.contentLen) {
|
||||
// https://tools.ietf.org/html/rfc7230#section-3.3.2
|
||||
if (typeof body === 'string') {
|
||||
this.rawHeaders.push('Content-Length', body.length)
|
||||
} else if (Buffer.isBuffer(body)) {
|
||||
this.rawHeaders.push('Content-Length', body.byteLength)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -412,6 +417,12 @@ module.exports = class Interceptor {
|
|||
}
|
||||
|
||||
matchHostName(options) {
|
||||
const { basePath } = this.scope
|
||||
|
||||
if (basePath instanceof RegExp) {
|
||||
return basePath.test(options.hostname)
|
||||
}
|
||||
|
||||
return options.hostname === this.scope.urlParts.hostname
|
||||
}
|
||||
|
||||
|
|
@ -442,13 +453,17 @@ module.exports = class Interceptor {
|
|||
markConsumed() {
|
||||
this.interceptionCounter++
|
||||
|
||||
remove(this)
|
||||
|
||||
if ((this.scope.shouldPersist() || this.counter > 0) && this.filePath) {
|
||||
if (
|
||||
(this.scope.shouldPersist() || this.counter > 0) &&
|
||||
this.interceptionCounter > 1 &&
|
||||
this.filePath
|
||||
) {
|
||||
this.body = fs.createReadStream(this.filePath)
|
||||
this.body.pause()
|
||||
}
|
||||
|
||||
remove(this)
|
||||
|
||||
if (!this.scope.shouldPersist() && this.counter < 1) {
|
||||
this.scope.remove(this._key, this)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue