File tree Expand file tree Collapse file tree 4 files changed +11
-0
lines changed
goldens/public-api/common/http Expand file tree Collapse file tree 4 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -1872,6 +1872,7 @@ export interface HttpResourceRequest {
1872
1872
body? : unknown ;
1873
1873
context? : HttpContext ;
1874
1874
headers? : HttpHeaders | Record <string , string | ReadonlyArray <string >>;
1875
+ keepalive? : boolean ;
1875
1876
method? : string ;
1876
1877
params? : HttpParams | Record <string , string | number | boolean | ReadonlyArray <string | number | boolean >>;
1877
1878
reportProgress? : boolean ;
Original file line number Diff line number Diff line change @@ -278,6 +278,7 @@ function normalizeRequest(
278
278
params,
279
279
reportProgress : unwrappedRequest . reportProgress ,
280
280
withCredentials : unwrappedRequest . withCredentials ,
281
+ keepalive : unwrappedRequest . keepalive ,
281
282
responseType,
282
283
context : unwrappedRequest . context ,
283
284
transferCache : unwrappedRequest . transferCache ,
Original file line number Diff line number Diff line change @@ -70,6 +70,11 @@ export interface HttpResourceRequest {
70
70
*/
71
71
withCredentials ?: boolean ;
72
72
73
+ /**
74
+ * When using the fetch implementation and set to `true`, the browser will not abort the associated request if the page that initiated it is unloaded before the request is complete.
75
+ */
76
+ keepalive ?: boolean ;
77
+
73
78
/**
74
79
* Configures the server-side rendering transfer cache for this request.
75
80
*
Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ describe('httpResource', () => {
105
105
'fast' : 'yes' ,
106
106
} ,
107
107
withCredentials : true ,
108
+ keepalive : true ,
108
109
} ) ,
109
110
{ injector : TestBed . inject ( Injector ) } ,
110
111
) ;
@@ -114,6 +115,7 @@ describe('httpResource', () => {
114
115
expect ( req . request . body ) . toEqual ( { message : 'Hello, backend!' } ) ;
115
116
expect ( req . request . headers . get ( 'X-Special' ) ) . toBe ( 'true' ) ;
116
117
expect ( req . request . withCredentials ) . toBe ( true ) ;
118
+ expect ( req . request . keepalive ) . toBe ( true ) ;
117
119
118
120
req . flush ( [ ] ) ;
119
121
@@ -201,6 +203,7 @@ describe('httpResource', () => {
201
203
reportProgress : true ,
202
204
context : new HttpContext ( ) . set ( CTX_TOKEN , 'bar' ) ,
203
205
withCredentials : true ,
206
+ keepalive : true ,
204
207
transferCache : { includeHeaders : [ 'Y-Tag' ] } ,
205
208
} ) ,
206
209
{
@@ -215,6 +218,7 @@ describe('httpResource', () => {
215
218
expect ( req . request . withCredentials ) . toEqual ( true ) ;
216
219
expect ( req . request . context . get ( CTX_TOKEN ) ) . toEqual ( 'bar' ) ;
217
220
expect ( req . request . reportProgress ) . toEqual ( true ) ;
221
+ expect ( req . request . keepalive ) . toBe ( true ) ;
218
222
expect ( req . request . transferCache ) . toEqual ( { includeHeaders : [ 'Y-Tag' ] } ) ;
219
223
} ) ;
220
224
You can’t perform that action at this time.
0 commit comments