(cacheOptions: HttpTransferCacheOptions)
| 440 | * |
| 441 | */ |
| 442 | export function withHttpTransferCache(cacheOptions: HttpTransferCacheOptions): Provider[] { |
| 443 | return [ |
| 444 | { |
| 445 | provide: CACHE_OPTIONS, |
| 446 | useFactory: (): CacheOptions => { |
| 447 | performanceMarkFeature('NgHttpTransferCache'); |
| 448 | return {isCacheActive: true, ...cacheOptions}; |
| 449 | }, |
| 450 | }, |
| 451 | { |
| 452 | provide: HTTP_ROOT_INTERCEPTOR_FNS, |
| 453 | useValue: transferCacheInterceptorFn, |
| 454 | multi: true, |
| 455 | }, |
| 456 | { |
| 457 | provide: APP_BOOTSTRAP_LISTENER, |
| 458 | multi: true, |
| 459 | useFactory: () => { |
| 460 | const appRef = inject(ApplicationRef); |
| 461 | const cacheState = inject(CACHE_OPTIONS); |
| 462 | |
| 463 | return () => { |
| 464 | appRef.whenStable().then(() => { |
| 465 | cacheState.isCacheActive = false; |
| 466 | }); |
| 467 | }; |
| 468 | }, |
| 469 | }, |
| 470 | ]; |
| 471 | } |
| 472 | |
| 473 | /** |
| 474 | * This function will add a proxy to an HttpHeader to intercept calls to get/has |
no test coverage detected