This repository was archived by the owner on Feb 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1167,8 +1167,7 @@ class File extends ServiceObject {
11671167
11681168 return ;
11691169 }
1170-
1171- const headers = rawResponseStream . toJSON ( ) . headers ;
1170+ const headers = rawResponseStream . headers ;
11721171 const isCompressed = headers [ 'content-encoding' ] === 'gzip' ;
11731172 const shouldRunValidation = ! rangeRequest && ( crc32c || md5 ) ;
11741173 const throughStreams : Writable [ ] = [ ] ;
@@ -1185,10 +1184,10 @@ class File extends ServiceObject {
11851184 if ( throughStreams . length === 1 ) {
11861185 rawResponseStream =
11871186 // tslint:disable-next-line:no-any
1188- ( rawResponseStream . pipe ( throughStreams [ 0 ] ) as any ) ;
1187+ ( ( rawResponseStream . body as Readable ) . pipe ( throughStreams [ 0 ] ) as any ) ;
11891188 } else if ( throughStreams . length > 1 ) {
11901189 rawResponseStream =
1191- rawResponseStream . pipe ( pumpify . obj ( throughStreams ) ) ;
1190+ ( rawResponseStream . body as Readable ) . pipe ( pumpify . obj ( throughStreams ) ) ;
11921191 }
11931192
11941193 rawResponseStream . on ( 'end' , onComplete ) . pipe ( throughStream , {
Original file line number Diff line number Diff line change @@ -714,10 +714,9 @@ describe('File', () => {
714714 ( err : Error , res : { } , body : { } , callback : Function ) => {
715715 const rawResponseStream = through ( ) ;
716716 Object . assign ( rawResponseStream , {
717- toJSON ( ) {
718- return { headers : { } } ;
719- } ,
717+ headers : { }
720718 } ) ;
719+
721720 callback ( null , null , rawResponseStream ) ;
722721 setImmediate ( ( ) => {
723722 rawResponseStream . end ( ) ;
@@ -937,13 +936,9 @@ describe('File', () => {
937936 ( err : Error , res : { } , body : { } , callback : Function ) => {
938937 const rawResponseStream = through ( ) ;
939938 Object . assign ( rawResponseStream , {
940- toJSON ( ) {
941- return {
942- headers : {
943- 'content-encoding' : 'gzip' ,
944- } ,
945- } ;
946- } ,
939+ headers : {
940+ 'content-encoding' : 'gzip' ,
941+ }
947942 } ) ;
948943 callback ( null , null , rawResponseStream ) ;
949944 setImmediate ( ( ) => {
You can’t perform that action at this time.
0 commit comments