@nxtedition/nxt-undici 3.1.2 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/interceptor/dns.js +3 -3
- package/package.json +1 -1
package/lib/interceptor/dns.js
CHANGED
|
@@ -53,17 +53,17 @@ export default (opts) => (dispatch) => (opts, handler) => {
|
|
|
53
53
|
const url = new URL(opts.origin)
|
|
54
54
|
const hostname = url.hostname
|
|
55
55
|
|
|
56
|
-
const callback = (err,
|
|
56
|
+
const callback = (err, entries) => {
|
|
57
57
|
if (err) {
|
|
58
58
|
handler.onConnect(() => {})
|
|
59
59
|
handler.onError(err)
|
|
60
60
|
} else {
|
|
61
|
-
url.hostname = address
|
|
61
|
+
url.hostname = entries[entries.length * Math.random()].address
|
|
62
62
|
dispatch({ ...opts, origin: url.origin }, new Handler(opts, hostname, { handler }))
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
const thenable = dns.lookup(new URL(opts.origin), callback)
|
|
66
|
+
const thenable = dns.lookup(new URL(opts.origin), { all: true }, callback)
|
|
67
67
|
if (typeof thenable?.then === 'function') {
|
|
68
68
|
thenable.then(
|
|
69
69
|
(val) => callback(null, val),
|