Skip to content

Commit

Permalink
Prevent error response has been emitted already.
Browse files Browse the repository at this point in the history
Prevents throwing an error if the HTTP content stream is piped.

Fixes: 1803
  • Loading branch information
Borewit committed Jul 24, 2021
1 parent f896aa5 commit dec028d
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions source/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2822,10 +2822,6 @@ export default class Request extends Duplex implements RequestEvents<Request> {
}

pipe<T extends NodeJS.WritableStream>(destination: T, options?: {end?: boolean}): T {
if (this[kStartedReading]) {
throw new Error('Failed to pipe. The response has been emitted already.');
}

if (destination instanceof ServerResponse) {
this[kServerResponsesPiped].add(destination);
}
Expand Down

0 comments on commit dec028d

Please sign in to comment.