@nxtedition/nxt-undici 6.2.15 → 6.2.16
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.
|
@@ -4,7 +4,6 @@ import { DecoratorHandler, isDisturbed, decorateError, parseRangeHeader } from '
|
|
|
4
4
|
|
|
5
5
|
function noop() {}
|
|
6
6
|
|
|
7
|
-
// TODO (fix): What about onUpgrade?
|
|
8
7
|
class Handler extends DecoratorHandler {
|
|
9
8
|
#dispatch
|
|
10
9
|
#opts
|
|
@@ -77,6 +76,11 @@ class Handler extends DecoratorHandler {
|
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
|
|
79
|
+
onUpgrade() {
|
|
80
|
+
// TODO (fix): Should we support this?
|
|
81
|
+
throw new Error('not supported')
|
|
82
|
+
}
|
|
83
|
+
|
|
80
84
|
onHeaders(statusCode, headers, resume) {
|
|
81
85
|
this.#statusCode = statusCode
|
|
82
86
|
this.#headers = headers
|
|
@@ -149,13 +153,13 @@ class Handler extends DecoratorHandler {
|
|
|
149
153
|
|
|
150
154
|
if (this.#pos > 0 && this.#etag !== headers.etag) {
|
|
151
155
|
this.#maybeError(null)
|
|
152
|
-
return
|
|
156
|
+
return false
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
const contentRange = parseRangeHeader(headers['content-range'])
|
|
156
160
|
if (!contentRange) {
|
|
157
161
|
this.#maybeError(null)
|
|
158
|
-
return
|
|
162
|
+
return false
|
|
159
163
|
}
|
|
160
164
|
|
|
161
165
|
const { start, size, end = size } = contentRange
|
|
@@ -168,6 +172,7 @@ class Handler extends DecoratorHandler {
|
|
|
168
172
|
return true
|
|
169
173
|
} else {
|
|
170
174
|
this.#maybeError(this.#retryError)
|
|
175
|
+
return false
|
|
171
176
|
}
|
|
172
177
|
}
|
|
173
178
|
|
|
@@ -361,6 +366,7 @@ class Handler extends DecoratorHandler {
|
|
|
361
366
|
export default () => (dispatch) => (opts, handler) =>
|
|
362
367
|
opts.retry !== false &&
|
|
363
368
|
!opts.upgrade &&
|
|
364
|
-
(/^(HEAD|GET|PUT|PATCH)$/.test(opts.method) || opts.idempotent)
|
|
369
|
+
(/^(HEAD|GET|PUT|PATCH|QUERY)$/.test(opts.method) || opts.idempotent) &&
|
|
370
|
+
opts.idempotent !== false
|
|
365
371
|
? dispatch(opts, new Handler(opts, { handler, dispatch }))
|
|
366
372
|
: dispatch(opts, handler)
|