@nxtedition/nxt-undici 3.1.0 → 3.1.2

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.
@@ -6,17 +6,17 @@ export default (opts) => (dispatch) => (opts, handler) => {
6
6
  return
7
7
  }
8
8
 
9
- try {
10
- const callback = (err, origin) => {
11
- if (err) {
12
- handler.onConnect(() => {})
13
- handler.onError(err)
14
- } else {
15
- dispatch({ ...opts, origin }, handler)
16
- }
9
+ const callback = (err, origin) => {
10
+ if (err) {
11
+ handler.onConnect(() => {})
12
+ handler.onError(err)
13
+ } else {
14
+ dispatch({ ...opts, origin }, handler)
17
15
  }
16
+ }
18
17
 
19
- const thenable = lookup(new URL(opts.origin), callback)
18
+ try {
19
+ const thenable = lookup(opts.origin, { signal: opts.signal }, callback)
20
20
  if (typeof thenable?.then === 'function') {
21
21
  thenable.then(
22
22
  (val) => callback(null, val),
@@ -24,7 +24,6 @@ export default (opts) => (dispatch) => (opts, handler) => {
24
24
  )
25
25
  }
26
26
  } catch (err) {
27
- handler.onConnect(() => {})
28
- handler.onError(err)
27
+ queueMicrotask(() => callback(err))
29
28
  }
30
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",