@@ -88,37 +88,38 @@ export class FetchHttpHandler implements HttpHandler {
8888
8989 const fetchRequest = new Request ( url , requestOptions ) ;
9090 const raceOfPromises = [
91- this . fetchFunction ! . apply ( window , [ fetchRequest ] ) . then (
92- ( response ) => {
93- const fetchHeaders : any = response . headers ;
94- const transformedHeaders : HeaderBag = { } ;
95-
96- for ( const pair of fetchHeaders . entries ( ) as string [ ] [ ] ) {
97- transformedHeaders [ pair [ 0 ] ] = pair [ 1 ] ;
98- }
99-
100- const hasReadableStream = response . body !== undefined ;
101-
102- // Return the response with buffered body
103- if ( ! hasReadableStream ) {
104- return response . blob ( ) . then ( ( body ) => ( {
105- response : new HttpResponse ( {
106- headers : transformedHeaders ,
107- statusCode : response . status ,
108- body
109- } )
110- } ) ) ;
111- }
112- // Return the response with streaming body
113- return {
91+ this . fetchFunction ! . apply ( window , [
92+ fetchRequest ,
93+ { keepalive : true }
94+ ] ) . then ( ( response ) => {
95+ const fetchHeaders : any = response . headers ;
96+ const transformedHeaders : HeaderBag = { } ;
97+
98+ for ( const pair of fetchHeaders . entries ( ) as string [ ] [ ] ) {
99+ transformedHeaders [ pair [ 0 ] ] = pair [ 1 ] ;
100+ }
101+
102+ const hasReadableStream = response . body !== undefined ;
103+
104+ // Return the response with buffered body
105+ if ( ! hasReadableStream ) {
106+ return response . blob ( ) . then ( ( body ) => ( {
114107 response : new HttpResponse ( {
115108 headers : transformedHeaders ,
116109 statusCode : response . status ,
117- body : response . body
110+ body
118111 } )
119- } ;
112+ } ) ) ;
120113 }
121- ) ,
114+ // Return the response with streaming body
115+ return {
116+ response : new HttpResponse ( {
117+ headers : transformedHeaders ,
118+ statusCode : response . status ,
119+ body : response . body
120+ } )
121+ } ;
122+ } ) ,
122123 requestTimeout ( requestTimeoutInMs )
123124 ] ;
124125 if ( abortSignal ) {
0 commit comments