@nxtedition/nxt-undici 3.1.2 → 3.1.4

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.
@@ -50,20 +50,20 @@ export default (opts) => (dispatch) => (opts, handler) => {
50
50
  assert(typeof dns.lookup === 'function')
51
51
  assert(typeof dns.clear === 'function')
52
52
 
53
- const url = new URL(opts.origin)
54
- const hostname = url.hostname
53
+ const { hostname } = new URL(opts.origin)
55
54
 
56
- const callback = (err, address) => {
55
+ const callback = (err, entries) => {
57
56
  if (err) {
58
57
  handler.onConnect(() => {})
59
58
  handler.onError(err)
60
59
  } else {
61
- url.hostname = address
60
+ const url = new URL(opts.origin)
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(hostname, { all: true }, callback)
67
67
  if (typeof thenable?.then === 'function') {
68
68
  thenable.then(
69
69
  (val) => callback(null, val),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",