make-fetch-happen
Advanced tools
Comparing version 2.4.0 to 2.4.1
24
cache.js
@@ -41,2 +41,3 @@ 'use strict' | ||
match (req, opts) { | ||
opts = opts || {} | ||
const key = cacheKey(req) | ||
@@ -72,3 +73,5 @@ return cacache.get.info(this._path, key).then(info => { | ||
pipe( | ||
cacache.get.stream.byDigest(cachePath, info.integrity), | ||
cacache.get.stream.byDigest(cachePath, info.integrity, { | ||
memoize: opts.memoize | ||
}), | ||
body, | ||
@@ -80,3 +83,3 @@ () => {} | ||
cacache.get.byDigest(cachePath, info.integrity, { | ||
memoize: opts.memoize !== false | ||
memoize: opts.memoize | ||
}).then(data => { | ||
@@ -111,2 +114,3 @@ body.write(data, () => { | ||
put (req, response, opts) { | ||
opts = opts || {} | ||
const size = response.headers.get('content-length') | ||
@@ -125,3 +129,3 @@ const fitInMemory = !!size && opts.memoize !== false && size < MAX_MEM_SIZE | ||
size, | ||
memoize: fitInMemory | ||
memoize: fitInMemory && opts.memoize | ||
} | ||
@@ -200,3 +204,15 @@ if (req.method === 'HEAD' || response.status === 304) { | ||
// is found, it returns false. | ||
'delete' (req) { | ||
'delete' (req, opts) { | ||
opts = opts || {} | ||
if (typeof opts.memoize === 'object') { | ||
if (opts.memoize.reset) { | ||
opts.memoize.reset() | ||
} else if (opts.memoize.clear) { | ||
opts.memoize.clear() | ||
} else { | ||
Object.keys(opts.memoize).forEach(k => { | ||
opts.memoize[k] = null | ||
}) | ||
} | ||
} | ||
return cacache.rm.entry( | ||
@@ -203,0 +219,0 @@ this._path, |
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="2.4.1"></a> | ||
## [2.4.1](https://github.com/zkat/make-fetch-happen/compare/v2.4.0...v2.4.1) (2017-04-28) | ||
### Bug Fixes | ||
* **memoization:** missed spots + allow passthrough of memo objs ([ac0cd12](https://github.com/zkat/make-fetch-happen/commit/ac0cd12)) | ||
<a name="2.4.0"></a> | ||
@@ -7,0 +17,0 @@ # [2.4.0](https://github.com/zkat/make-fetch-happen/compare/v2.3.0...v2.4.0) (2017-04-28) |
{ | ||
"name": "make-fetch-happen", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"description": "Opinionated, caching, retrying fetch client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
54658
737