@@ -151,7 +151,6 @@ export default class Request extends Duplex implements RequestEvents<Request> {
151
151
private _downloadedSize : number ;
152
152
private _uploadedSize : number ;
153
153
private _stopReading : boolean ;
154
- private _startedReading : boolean ;
155
154
private readonly _pipedServerResponses : Set < ServerResponse > ;
156
155
private _request ?: ClientRequest ;
157
156
private _responseSize ?: number ;
@@ -180,7 +179,6 @@ export default class Request extends Duplex implements RequestEvents<Request> {
180
179
this . _downloadedSize = 0 ;
181
180
this . _uploadedSize = 0 ;
182
181
this . _stopReading = false ;
183
- this . _startedReading = false ;
184
182
this . _pipedServerResponses = new Set < ServerResponse > ( ) ;
185
183
this . _cannotHaveBody = false ;
186
184
this . _unproxyEvents = noop ;
@@ -435,7 +433,6 @@ export default class Request extends Duplex implements RequestEvents<Request> {
435
433
let data ;
436
434
while ( ( data = response . read ( ) ) !== null ) {
437
435
this . _downloadedSize += data . length ;
438
- this . _startedReading = true ;
439
436
440
437
const progress = this . downloadProgress ;
441
438
@@ -522,10 +519,6 @@ export default class Request extends Duplex implements RequestEvents<Request> {
522
519
}
523
520
524
521
pipe < T extends NodeJS . WritableStream > ( destination : T , options ?: { end ?: boolean } ) : T {
525
- if ( this . _startedReading ) {
526
- throw new Error ( 'Failed to pipe. The response has been emitted already.' ) ;
527
- }
528
-
529
522
if ( destination instanceof ServerResponse ) {
530
523
this . _pipedServerResponses . add ( destination ) ;
531
524
}
0 commit comments