File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ import normalizePromiseArguments from '../as-promise/normalize-arguments';
3131import { PromiseOnly } from '../as-promise/types' ;
3232import calculateRetryDelay from './calculate-retry-delay' ;
3333
34- const globalDnsCache = new CacheableLookup ( ) ;
34+ let globalDnsCache : CacheableLookup ;
3535
3636type HttpRequestFunction = typeof httpRequest ;
3737type Error = NodeJS . ErrnoException ;
@@ -1762,6 +1762,10 @@ export default class Request extends Duplex implements RequestEvents<Request> {
17621762
17631763 // `options.dnsCache`
17641764 if ( options . dnsCache === true ) {
1765+ if ( ! globalDnsCache ) {
1766+ globalDnsCache = new CacheableLookup ( ) ;
1767+ }
1768+
17651769 options . dnsCache = globalDnsCache ;
17661770 } else if ( ! is . undefined ( options . dnsCache ) && ! options . dnsCache . lookup ) {
17671771 throw new TypeError ( `Parameter \`dnsCache\` must be a CacheableLookup instance or a boolean, got ${ is ( options . dnsCache ) } ` ) ;
You can’t perform that action at this time.
0 commit comments