File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2492,9 +2492,8 @@ export default class Request extends Duplex implements RequestEvents<Request> {
24922492
24932493 try {
24942494 response . rawBody = await getBuffer ( response ) ;
2495+ response . body = response . rawBody . toString ( ) ;
24952496 } catch { }
2496-
2497- response . body = response . rawBody . toString ( ) ;
24982497 }
24992498
25002499 if ( this . listenerCount ( 'retry' ) !== 0 ) {
@@ -2604,6 +2603,11 @@ export default class Request extends Duplex implements RequestEvents<Request> {
26042603 }
26052604
26062605 _writeRequest ( chunk : any , encoding : BufferEncoding | undefined , callback : ( error ?: Error | null ) => void ) : void {
2606+ if ( this [ kRequest ] ! . destroyed ) {
2607+ // Probably the `ClientRequest` instance will throw
2608+ return ;
2609+ }
2610+
26072611 this . _progressCallbacks . push ( ( ) : void => {
26082612 this [ kUploadedSize ] += Buffer . byteLength ( chunk , encoding ) ;
26092613
You can’t perform that action at this time.
0 commit comments