(cacheOptions: HttpTransferCacheOptions)
| 466 | * |
| 467 | */ |
| 468 | export function withHttpTransferCache(cacheOptions: HttpTransferCacheOptions): Provider[] { |
| 469 | return [ |
| 470 | { |
| 471 | provide: CACHE_OPTIONS, |
| 472 | useFactory: (): CacheOptions => { |
| 473 | performanceMarkFeature('NgHttpTransferCache'); |
| 474 | return {isCacheActive: true, ...cacheOptions}; |
| 475 | }, |
| 476 | }, |
| 477 | { |
| 478 | provide: HTTP_ROOT_INTERCEPTOR_FNS, |
| 479 | useValue: transferCacheInterceptorFn, |
| 480 | multi: true, |
| 481 | }, |
| 482 | { |
| 483 | provide: APP_BOOTSTRAP_LISTENER, |
| 484 | multi: true, |
| 485 | useFactory: () => { |
| 486 | const appRef = inject(ApplicationRef); |
| 487 | const cacheState = inject(CACHE_OPTIONS); |
| 488 | |
| 489 | return () => { |
| 490 | appRef.whenStable().then(() => { |
| 491 | cacheState.isCacheActive = false; |
| 492 | }); |
| 493 | }; |
| 494 | }, |
| 495 | }, |
| 496 | ]; |
| 497 | } |
| 498 | |
| 499 | /** |
| 500 | * This function will add a proxy to an HttpHeader to intercept calls to get/has |
no test coverage detected