@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 +7 -0
- package/lib/readable.js +1 -1
- package/package.json +1 -1
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 (
|
|
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
|