got 12.4.0 → 12.4.1
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.
|
@@ -431,6 +431,7 @@ export default class Request extends Duplex {
|
|
|
431
431
|
if (this._request._writableState?.errored) {
|
|
432
432
|
return;
|
|
433
433
|
}
|
|
434
|
+
// The `!destroyed` check is required to prevent `uploadProgress` being emitted after the stream was destroyed
|
|
434
435
|
if (!error) {
|
|
435
436
|
this._bodySize = this._uploadedSize;
|
|
436
437
|
this.emit('uploadProgress', this.uploadProgress);
|
|
@@ -998,7 +999,8 @@ export default class Request extends Duplex {
|
|
|
998
999
|
return;
|
|
999
1000
|
}
|
|
1000
1001
|
this._request.write(chunk, encoding, (error) => {
|
|
1001
|
-
|
|
1002
|
+
// The `!destroyed` check is required to prevent `uploadProgress` being emitted after the stream was destroyed
|
|
1003
|
+
if (!error && !this._request.destroyed) {
|
|
1002
1004
|
this._uploadedSize += Buffer.byteLength(chunk, encoding);
|
|
1003
1005
|
const progress = this.uploadProgress;
|
|
1004
1006
|
if (progress.percent < 1) {
|