@nxtedition/nxt-undici 2.0.48 → 2.0.49

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.
package/lib/index.js CHANGED
@@ -210,6 +210,13 @@ export async function request(url, opts) {
210
210
  size: Number.isFinite(contentLength) ? contentLength : null,
211
211
  })
212
212
 
213
+ if (this.signal) {
214
+ this.body.on('close', () => {
215
+ this.signal?.removeEventListener('abort', this.onAbort)
216
+ this.signal = null
217
+ })
218
+ }
219
+
213
220
  this.resolve(this.body)
214
221
  this.resolve = null
215
222
  this.reject = null
package/lib/readable.js CHANGED
@@ -90,7 +90,7 @@ export class BodyReadable extends Readable {
90
90
  this[kHandler].signal = null
91
91
  }
92
92
 
93
- if (err) {
93
+ if (!this[kReading]) {
94
94
  // Workaround for Node "bug". If the stream is destroyed in same
95
95
  // tick as it is created, then a user who is waiting for a
96
96
  // promise (i.e micro tick) for installing a 'error' listener will
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "2.0.48",
3
+ "version": "2.0.49",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",