@nxtedition/nxt-undici 7.1.0 → 7.1.2

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.
@@ -13,8 +13,9 @@ class FactoryStream extends Readable {
13
13
 
14
14
  _construct(callback) {
15
15
  this.#ac = new AbortController()
16
- Promise.resolve(() => this.#factory({ signal: this.#ac.signal })).then(
16
+ Promise.resolve(this.#factory({ signal: this.#ac.signal })).then(
17
17
  (body) => {
18
+ this.#ac = null
18
19
  try {
19
20
  if (typeof body === 'string' || body instanceof Buffer) {
20
21
  this.push(body)
@@ -49,11 +50,16 @@ class FactoryStream extends Readable {
49
50
  }
50
51
 
51
52
  _destroy(err, callback) {
52
- if (this.#ac != null) {
53
- this.#ac.abort()
53
+ if (this.#ac) {
54
+ this.#ac.abort(err)
54
55
  this.#ac = null
55
56
  }
56
57
 
58
+ if (this.#body) {
59
+ this.#body.destroy(err)
60
+ this.#body = null
61
+ }
62
+
57
63
  callback(err)
58
64
  }
59
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "7.1.0",
3
+ "version": "7.1.2",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",