@nxtedition/nxt-undici 6.0.13 → 6.0.15

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.
@@ -152,7 +152,7 @@ class Handler extends DecoratorHandler {
152
152
 
153
153
  let retryPromise
154
154
  try {
155
- retryPromise = retryFn(err, this.#retryCount, { ...this.#opts.retry })
155
+ retryPromise = retryFn(err, this.#retryCount, this.#opts)
156
156
  } catch (err) {
157
157
  retryPromise = Promise.reject(err)
158
158
  }
package/lib/utils.js CHANGED
@@ -80,19 +80,21 @@ export function parseContentRange(range) {
80
80
  }
81
81
 
82
82
  export async function retry(err, retryCount, opts) {
83
- if (!opts) {
83
+ let retryOpts = opts?.retry
84
+
85
+ if (retryOpts) {
84
86
  throw err
85
87
  }
86
88
 
87
- if (typeof opts === 'function') {
88
- return opts(err, retryCount, opts, (opts) => retry(err, retryCount, opts))
89
+ if (typeof retryOpts === 'function') {
90
+ return retryOpts(err, retryCount, opts, () => retry(err, retryCount, opts))
89
91
  }
90
92
 
91
- if (typeof opts === 'number') {
92
- opts = { count: opts }
93
+ if (typeof retryOpts === 'number') {
94
+ retryOpts = { count: retryOpts }
93
95
  }
94
96
 
95
- const retryMax = opts?.count ?? 8
97
+ const retryMax = retryOpts?.count ?? 8
96
98
 
97
99
  if (retryCount > retryMax) {
98
100
  throw err
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "6.0.13",
3
+ "version": "6.0.15",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",