nock
Advanced tools
Comparing version 13.2.2 to 13.2.3
@@ -54,4 +54,8 @@ 'use strict' | ||
// https://nodejs.org/docs/latest-v12.x/api/http.html#http_http_request_url_options_callback | ||
if (options.timeout) { | ||
this.socket.setTimeout(options.timeout) | ||
// any timeout in the request options override any timeout in the agent options. | ||
// per https://github.com/nodejs/node/pull/21204 | ||
const timeout = | ||
options.timeout || (options.agent && options.agent.options.timeout) | ||
if (timeout) { | ||
this.socket.setTimeout(timeout) | ||
} | ||
@@ -58,0 +62,0 @@ |
@@ -159,3 +159,3 @@ 'use strict' | ||
// 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 ( | ||
@@ -178,6 +178,10 @@ body && | ||
} | ||
} | ||
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) | ||
} | ||
@@ -184,0 +188,0 @@ } |
@@ -82,3 +82,3 @@ 'use strict' | ||
_read(size) { | ||
_read(_size) { | ||
while (this.buffers.length) { | ||
@@ -319,3 +319,3 @@ if (!this.push(this.buffers.shift())) { | ||
// during a single microtask execution. This setImmediate stalls the playback to ensure the | ||
// correct events are emitted first ('socket', 'finish') and any aborts in the in the queue or | ||
// correct events are emitted first ('socket', 'finish') and any aborts in the queue or | ||
// called during a 'finish' listener can be called. | ||
@@ -322,0 +322,0 @@ common.setImmediate(() => { |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "13.2.2", | ||
"version": "13.2.3", | ||
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>", | ||
@@ -18,3 +18,3 @@ "repository": { | ||
"bugs": { | ||
"url": "http://github.com/nock/nock/issues" | ||
"url": "https://github.com/nock/nock/issues" | ||
}, | ||
@@ -33,10 +33,10 @@ "engines": { | ||
"devDependencies": { | ||
"@sinonjs/fake-timers": "^8.1.0", | ||
"@definitelytyped/dtslint": "^0.0.103", | ||
"@sinonjs/fake-timers": "^9.0.0", | ||
"assert-rejects": "^1.0.0", | ||
"chai": "^4.1.2", | ||
"dirty-chai": "^2.0.1", | ||
"dtslint": "^4.0.4", | ||
"eslint": "^7.3.1", | ||
"eslint": "^8.8.0", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-config-standard": "^16.0.2", | ||
"eslint-config-standard": "^17.0.0-0", | ||
"eslint-plugin-import": "^2.16.0", | ||
@@ -46,3 +46,2 @@ "eslint-plugin-mocha": "^10.0.3", | ||
"eslint-plugin-promise": "^6.0.0", | ||
"eslint-plugin-standard": "^5.0.0", | ||
"form-data": "^4.0.0", | ||
@@ -57,3 +56,3 @@ "got": "^11.3.0", | ||
"semantic-release": "^18.0.1", | ||
"sinon": "^12.0.1", | ||
"sinon": "^13.0.1", | ||
"sinon-chai": "^3.7.0", | ||
@@ -60,0 +59,0 @@ "typescript": "^4.2.2" |
178881
24
3504