Comparing version 5.0.1 to 5.0.2
13
index.js
@@ -88,3 +88,2 @@ module.exports = extend() | ||
} | ||
// or redirect and leave | ||
@@ -115,3 +114,2 @@ if (opts.followRedirects !== false && res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) { | ||
} | ||
// or read response and leave at the end | ||
@@ -132,7 +130,10 @@ response = res | ||
req.once('timeout', () => { | ||
// This timeout event can come after the input pipeline is finished (ex. timeout with no body) | ||
const _error = new Error('TimeoutError'); _error.code = 'ETIMEDOUT' | ||
req.destroy() // we must destroy manually | ||
onRequestEnd(_error) // This timeout event can come after the input pipeline is finished (ex. timeout with no body) | ||
req.destroy(_error) // we must destroy manually and send the error to the error listener to call onRequestEnd | ||
}) | ||
req.once('error', (e) => { | ||
onRequestEnd(e) // error can happen before pipeline is executed when some interceptor are used such as nock | ||
req.destroy() | ||
}) | ||
const _inputStream = isFnStream(body) ? body(opts) : Readable.from([body], { objectMode: false }) | ||
@@ -142,3 +143,2 @@ pipeline(_inputStream, req, (e) => { | ||
}) | ||
return req | ||
@@ -160,4 +160,3 @@ } | ||
rock.extend = extend | ||
return rock | ||
} |
{ | ||
"name": "rock-req", | ||
"description": "Zero dependencies (160 LOC) & rock-solid request library: http/https, reliable retry on failure, redirects, gzip/deflate/brotli, extensible, proxy, streams, JSON mode, forms, timeout", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "David Grelaud & Feross Aboukhadijeh" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27632
149