@nxtedition/nxt-undici 2.1.1 → 2.2.0

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.
@@ -153,7 +153,7 @@ class Handler extends DecoratorHandler {
153
153
  this.#error = err
154
154
 
155
155
  retryPromise
156
- .then(() => {
156
+ .then((opts) => {
157
157
  if (this.#aborted) {
158
158
  this.#onError(this.#reason)
159
159
  } else if (isDisturbed(this.#opts.body)) {
@@ -167,8 +167,10 @@ class Handler extends DecoratorHandler {
167
167
 
168
168
  this.#opts = {
169
169
  ...this.#opts,
170
+ ...opts,
170
171
  headers: {
171
172
  ...this.#opts.headers,
173
+ ...opts?.headers,
172
174
  'if-match': this.#etag,
173
175
  range: `bytes=${this.#pos}-${this.#end ?? ''}`,
174
176
  },
@@ -204,25 +206,3 @@ export default (dispatch) => (opts, handler) => {
204
206
  ? dispatch(opts, new Handler(opts, { handler, dispatch }))
205
207
  : dispatch(opts, handler)
206
208
  }
207
-
208
- export function isConnectionError(err) {
209
- // AWS compat.
210
- const statusCode = err?.statusCode ?? err?.$metadata?.httpStatusCode
211
- return err
212
- ? err.code === 'ECONNRESET' ||
213
- err.code === 'ECONNREFUSED' ||
214
- err.code === 'ENOTFOUND' ||
215
- err.code === 'ENETDOWN' ||
216
- err.code === 'ENETUNREACH' ||
217
- err.code === 'EHOSTDOWN' ||
218
- err.code === 'EHOSTUNREACH' ||
219
- err.code === 'EPIPE' ||
220
- err.code === 'ETIMEDOUT' ||
221
- err.message === 'other side closed' ||
222
- statusCode === 420 ||
223
- statusCode === 429 ||
224
- statusCode === 502 ||
225
- statusCode === 503 ||
226
- statusCode === 504
227
- : false
228
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",