@nxtedition/nxt-undici 6.4.1 → 6.4.3

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.
@@ -175,6 +175,8 @@ class Handler extends DecoratorHandler {
175
175
  this.#pos += chunk.byteLength
176
176
  }
177
177
 
178
+ this.#retryCount = 0
179
+
178
180
  if (this.#statusCode < 400) {
179
181
  return super.onData(chunk)
180
182
  }
package/lib/request.js CHANGED
@@ -7,6 +7,10 @@ function noop() {}
7
7
 
8
8
  export class RequestHandler {
9
9
  constructor({ signal, method, body, highWaterMark }, resolve) {
10
+ if (isStream(body) && body.closed) {
11
+ body = null
12
+ }
13
+
10
14
  try {
11
15
  if (typeof resolve !== 'function') {
12
16
  throw new InvalidArgumentError('invalid resolve')
@@ -179,7 +183,18 @@ export function request(dispatch, url, opts) {
179
183
  path = url.search ? `${url.pathname}${url.search}` : url.pathname
180
184
  }
181
185
 
182
- opts = { ...opts, origin, path }
183
-
184
- return new Promise((resolve) => dispatch(opts, new RequestHandler(opts, resolve)))
186
+ return new Promise((resolve) =>
187
+ dispatch(
188
+ opts,
189
+ new RequestHandler(
190
+ {
191
+ ...opts,
192
+ origin,
193
+ path,
194
+ body: isStream(opts.body) && opts.body.readableEnded ? null : opts.body,
195
+ },
196
+ resolve,
197
+ ),
198
+ ),
199
+ )
185
200
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "6.4.1",
3
+ "version": "6.4.3",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",