Skip to content

Commit

Permalink
refactor!: removed default outgoing cacheable-lookup use
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `httpOptions` no longer defaults to using the npm module `cacheable-lookup` as its `dnsLookup` option. It defaults to `node:dns` module's `lookup` export instead.
  • Loading branch information
panva committed Dec 1, 2022
1 parent 079e2f2 commit 7c10920
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2330,7 +2330,7 @@ function httpOptions(url) {
return {
timeout: 2500,
agent: undefined, // defaults to node's global agents (https.globalAgent or http.globalAgent)
lookup: undefined, // defaults to CacheableLookup (https://github.com/szmarczak/cacheable-lookup)
lookup: undefined, // defaults to `dns.lookup()` (https://nodejs.org/api/dns.html#dnslookuphostname-options-callback)
};
}
```
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function httpOptions(url) {
return {
timeout: 2500,
agent: undefined, // defaults to node's global agents (https.globalAgent or http.globalAgent)
lookup: undefined, // defaults to CacheableLookup (https://github.com/szmarczak/cacheable-lookup)
lookup: undefined, // defaults to `dns.lookup()` (https://nodejs.org/api/dns.html#dnslookuphostname-options-callback)
};
}

Expand Down
7 changes: 0 additions & 7 deletions lib/helpers/request.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
const got = require('got');
const CacheableLookup = require('cacheable-lookup');
const QuickLRU = require('quick-lru');

const pickBy = require('./_/pick_by');
const instance = require('./weak_cache');

const cacheable = new CacheableLookup({
cache: new QuickLRU({ maxSize: 1000 }),
});

module.exports = async function request(options) {
Object.assign(options, {
url: new URL(options.url),
Expand Down Expand Up @@ -37,7 +31,6 @@ module.exports = async function request(options) {
retry: 0,
throwHttpErrors: false,
timeout: 2500,
lookup: cacheable.lookup,
...helperOptions,
});
};
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
},
"dependencies": {
"@koa/cors": "^3.3.0",
"cacheable-lookup": "^6.0.4",
"debug": "^4.3.4",
"ejs": "^3.1.8",
"got": "^11.8.5",
Expand Down

0 comments on commit 7c10920

Please sign in to comment.