/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { Provider } from '@angular/core'; import { Observable } from 'rxjs'; import { HttpHandlerFn } from './interceptor'; import { HttpRequest } from './request'; import { HttpEvent } from './response'; /** * Options to configure how TransferCache should be used to cache requests made via HttpClient. * * @param includeHeaders Specifies which headers should be included into cached responses. No * headers are included by default. * @param filter A function that receives a request as an argument and returns a boolean to indicate * whether a request should be included into the cache. * @param includePostRequests Enables caching for POST requests. By default, only GET and HEAD * requests are cached. This option can be enabled if POST requests are used to retrieve data * (for example using GraphQL). * * @publicApi */ export type HttpTransferCacheOptions = { includeHeaders?: string[]; filter?: (req: HttpRequest) => boolean; includePostRequests?: boolean; }; /** * Keys within cached response data structure. */ export declare const BODY = "b"; export declare const HEADERS = "h"; export declare const STATUS = "s"; export declare const STATUS_TEXT = "st"; export declare const URL = "u"; export declare const RESPONSE_TYPE = "rt"; export declare function transferCacheInterceptorFn(req: HttpRequest, next: HttpHandlerFn): Observable>; /** * Returns the DI providers needed to enable HTTP transfer cache. * * By default, when using server rendering, requests are performed twice: once on the server and * other one on the browser. * * When these providers are added, requests performed on the server are cached and reused during the * bootstrapping of the application in the browser thus avoiding duplicate requests and reducing * load time. * */ export declare function withHttpTransferCache(cacheOptions: HttpTransferCacheOptions): Provider[];