diff --git a/lib/cache/entry.js b/lib/cache/entry.js index 4629a48..b87af21 100644 --- a/lib/cache/entry.js +++ b/lib/cache/entry.js @@ -255,6 +255,7 @@ class CacheEntry { algorithms: this.options.algorithms, metadata: getMetadata(this.request, this.response, this.options), size, + integrity: this.options.integrity, } let body = null @@ -273,11 +274,9 @@ class CacheEntry { }, })) - let abortStream const onResume = () => { const tee = new Minipass() const cacheStream = cacache.put.stream(this.options.cachePath, this.key, cacheOpts) - abortStream = cacheStream tee.pipe(cacheStream) // TODO if the cache write fails, log a warning but return the response anyway cacheStream.promise().then(cacheWriteResolve, cacheWriteReject) @@ -287,11 +286,6 @@ class CacheEntry { body.once('resume', onResume) body.once('end', () => body.removeListener('resume', onResume)) - this.response.body.on('error', (err) => { - // listen for errors from the actual response and avoid writing data that we - // know to be invalid to the cache - abortStream.destroy(err) - }) } else { await cacache.index.insert(this.options.cachePath, this.key, null, cacheOpts) }