Skip to content

Commit

Permalink
Applied requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Giotino committed May 29, 2020
1 parent 3d91c6f commit 601fe10
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions source/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,10 @@ export default class Request extends Duplex implements RequestEvents<Request> {
}

async _beforeError(error: Error): Promise<void> {
if (this.destroyed) {
return;
}

this[kStopReading] = true;

if (!(error instanceof RequestError)) {
Expand All @@ -1484,10 +1488,7 @@ export default class Request extends Duplex implements RequestEvents<Request> {
error = new RequestError(error_.message, error_, this);
}

// This is a workaround for https://github.com/nodejs/node/issues/33335
if (!this.destroyed) {
this.destroy(error);
}
this.destroy(error);
}

_read(): void {
Expand Down

0 comments on commit 601fe10

Please sign in to comment.