@nxtedition/nxt-undici 6.3.8 → 6.3.10

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.
@@ -14,7 +14,7 @@ export default () => (dispatch) => (opts, handler) => {
14
14
  }
15
15
 
16
16
  try {
17
- const thenable = lookup(opts.origin, { signal: opts.signal }, callback)
17
+ const thenable = lookup(opts.origin, { signal: opts.signal ?? undefined }, callback)
18
18
  if (typeof thenable?.then === 'function') {
19
19
  thenable.then(
20
20
  (val) => callback(null, val),
@@ -3,7 +3,7 @@ export default () => (dispatch) => (opts, handler) => {
3
3
  return dispatch(opts, handler)
4
4
  }
5
5
 
6
- const body = opts.body({ signal: opts.signal })
6
+ const body = opts.body({ signal: opts.signal ?? undefined })
7
7
 
8
8
  if (typeof body?.then !== 'function') {
9
9
  return dispatch({ ...opts, body }, handler)
@@ -334,7 +334,7 @@ class Handler extends DecoratorHandler {
334
334
  retryAfter != null && Number.isFinite(retryAfter)
335
335
  ? retryAfter
336
336
  : Math.min(10e3, retryCount * 1e3)
337
- return tp.setTimeout(delay, true, { signal: opts.signal })
337
+ return tp.setTimeout(delay, true, { signal: opts?.signal ?? undefined })
338
338
  }
339
339
 
340
340
  if (
@@ -353,11 +353,15 @@ class Handler extends DecoratorHandler {
353
353
  'UND_ERR_CONNECT_TIMEOUT',
354
354
  ].includes(err.code)
355
355
  ) {
356
- return tp.setTimeout(Math.min(10e3, retryCount * 1e3), true, { signal: opts.signal })
356
+ return tp.setTimeout(Math.min(10e3, retryCount * 1e3), true, {
357
+ signal: opts?.signal ?? undefined,
358
+ })
357
359
  }
358
360
 
359
361
  if (err?.message && ['other side closed'].includes(err.message)) {
360
- return tp.setTimeout(Math.min(10e3, retryCount * 1e3), true, { signal: opts.signal })
362
+ return tp.setTimeout(Math.min(10e3, retryCount * 1e3), true, {
363
+ signal: opts?.signal ?? undefined,
364
+ })
361
365
  }
362
366
 
363
367
  return false
package/lib/utils.js CHANGED
@@ -378,6 +378,7 @@ export function decorateError(err, opts, { statusCode, headers, trailers, body }
378
378
  err.url ??= opts.origin ? new URL(opts.path, opts.origin).href : null
379
379
 
380
380
  err.req = {
381
+ url: err.url,
381
382
  method: opts?.method,
382
383
  headers: opts?.headers,
383
384
  body:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "6.3.8",
3
+ "version": "6.3.10",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",