make-fetch-happen
Advanced tools
Comparing version 10.1.0 to 10.1.1
@@ -8,3 +8,3 @@ const LRUCache = require('lru-cache') | ||
all: false, | ||
verbatim: true, | ||
verbatim: undefined, | ||
} | ||
@@ -11,0 +11,0 @@ |
{ | ||
"name": "make-fetch-happen", | ||
"version": "10.1.0", | ||
"version": "10.1.1", | ||
"description": "Opinionated, caching, retrying fetch client", | ||
@@ -58,3 +58,3 @@ "main": "lib/index.js", | ||
"@npmcli/eslint-config": "^3.0.1", | ||
"@npmcli/template-oss": "3.1.2", | ||
"@npmcli/template-oss": "3.2.0", | ||
"mkdirp": "^1.0.4", | ||
@@ -77,4 +77,4 @@ "nock": "^13.2.4", | ||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", | ||
"version": "3.1.2" | ||
"version": "3.2.0" | ||
} | ||
} |
@@ -187,41 +187,2 @@ # make-fetch-happen | ||
A possible (minimal) implementation for `MyCustomRedisCache`: | ||
```javascript | ||
const bluebird = require('bluebird') | ||
const redis = require("redis") | ||
bluebird.promisifyAll(redis.RedisClient.prototype) | ||
class MyCustomRedisCache { | ||
constructor (opts) { | ||
this.redis = redis.createClient(opts) | ||
} | ||
match (req) { | ||
return this.redis.getAsync(req.url).then(res => { | ||
if (res) { | ||
const parsed = JSON.parse(res) | ||
return new fetch.Response(parsed.body, { | ||
url: req.url, | ||
headers: parsed.headers, | ||
status: 200 | ||
}) | ||
} | ||
}) | ||
} | ||
put (req, res) { | ||
return res.buffer().then(body => { | ||
return this.redis.setAsync(req.url, JSON.stringify({ | ||
body: body, | ||
headers: res.headers.raw() | ||
})) | ||
}).then(() => { | ||
// return the response itself | ||
return res | ||
}) | ||
} | ||
'delete' (req) { | ||
return this.redis.unlinkAsync(req.url) | ||
} | ||
} | ||
``` | ||
#### <a name="opts-cache"></a> `> opts.cache` | ||
@@ -228,0 +189,0 @@ |
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
59352
363