About DNS implementation in got module #2386
|
Hi community, |
Answered by
sindresorhus
Oct 11, 2025
Replies: 1 comment 1 reply
|
Got uses Node's default DNS resolution which is For DNS caching, yes, you should use the import CacheableLookup from 'cacheable-lookup';
const cacheable = new CacheableLookup();
await got('https://example.com', {
dnsLookup: cacheable.lookup
});This is definately recommended if you're making many requests to the same hosts, as it can significantly improve performance by avoiding redundant DNS lookups. |
1 reply
Answer selected by
sindresorhus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Got uses Node's default DNS resolution which is
dns.lookup()under the hood (via the http/https modules).For DNS caching, yes, you should use the
cacheable-lookuppackage. You can pass it to Got like this:This is definately recommended if you're making many requests to the same hosts, as it can significantly improve performance by avoiding redundant DNS lookups.