make-fetch-happen
Advanced tools
Comparing version 2.4.13 to 2.5.0
15
agent.js
@@ -47,2 +47,10 @@ 'use strict' | ||
} | ||
// If opts.timeout is zero, set the agentTimeout to zero as well. A timeout | ||
// of zero disables the timeout behavior (OS limits still apply). Else, if | ||
// opts.timeout is a non-zero value, set it to timeout + 1, to ensure that | ||
// the node-fetch-npm timeout will always fire first, giving us more | ||
// consistent errors. | ||
const agentTimeout = opts.timeout === 0 ? 0 : opts.timeout + 1 | ||
const agent = isHttps ? new HttpsAgent({ | ||
@@ -54,6 +62,8 @@ maxSockets: opts.maxSockets || 15, | ||
localAddress: opts.localAddress, | ||
rejectUnauthorized: opts.strictSSL | ||
rejectUnauthorized: opts.strictSSL, | ||
timeout: agentTimeout | ||
}) : new HttpAgent({ | ||
maxSockets: opts.maxSockets || 15, | ||
localAddress: opts.localAddress | ||
localAddress: opts.localAddress, | ||
timeout: agentTimeout | ||
}) | ||
@@ -135,2 +145,3 @@ AGENT_CACHE.set(key, agent) | ||
key: opts.key, | ||
timeout: opts.timeout === 0 ? 0 : opts.timeout + 1, | ||
localAddress: opts.localAddress, | ||
@@ -137,0 +148,0 @@ maxSockets: opts.maxSockets || 15, |
@@ -5,2 +5,17 @@ # Change Log | ||
<a name="2.5.0"></a> | ||
# [2.5.0](https://github.com/zkat/make-fetch-happen/compare/v2.4.13...v2.5.0) (2017-08-24) | ||
### Bug Fixes | ||
* **agent:** support timeout durations greater than 30 seconds ([04875ae](https://github.com/zkat/make-fetch-happen/commit/04875ae)), closes [#35](https://github.com/zkat/make-fetch-happen/issues/35) | ||
### Features | ||
* **cache:** export cache deletion functionality (#40) ([3da4250](https://github.com/zkat/make-fetch-happen/commit/3da4250)) | ||
<a name="2.4.13"></a> | ||
@@ -7,0 +22,0 @@ ## [2.4.13](https://github.com/zkat/make-fetch-happen/compare/v2.4.12...v2.4.13) (2017-06-29) |
13
index.js
@@ -45,5 +45,18 @@ 'use strict' | ||
defaultedFetch.defaults = fetch.defaults | ||
defaultedFetch.delete = fetch.delete | ||
return defaultedFetch | ||
} | ||
cachingFetch.delete = cacheDelete | ||
function cacheDelete (uri, opts) { | ||
opts = configureOptions(opts) | ||
if (opts.cacheManager) { | ||
const req = new fetch.Request(uri, { | ||
method: opts.method, | ||
headers: opts.headers | ||
}) | ||
return opts.cacheManager.delete(req, opts) | ||
} | ||
} | ||
function initializeCache (opts) { | ||
@@ -50,0 +63,0 @@ if (typeof opts.cacheManager === 'string') { |
{ | ||
"name": "make-fetch-happen", | ||
"version": "2.4.13", | ||
"version": "2.5.0", | ||
"description": "Opinionated, caching, retrying fetch client", | ||
@@ -15,3 +15,3 @@ "main": "index.js", | ||
"pretest": "standard lib test *.js", | ||
"test": "nyc --all -- tap -J test/*.js", | ||
"test": "nyc --all -- tap --timeout=35 -J test/*.js", | ||
"update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", | ||
@@ -52,5 +52,6 @@ "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" | ||
"mkdirp": "^0.5.1", | ||
"nock": "^9.0.6", | ||
"nock": "^9.0.14", | ||
"npmlog": "^4.1.2", | ||
"nyc": "^11.0.3", | ||
"require-inject": "^1.4.2", | ||
"rimraf": "^2.5.4", | ||
@@ -57,0 +58,0 @@ "safe-buffer": "^5.1.1", |
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
62042
805
14
18