[ Web Proxy ]
URL:
Viewing: https://angular.dev/api/common/http/HttpTransferCacheOptions [Back]  [Original]

HttpTransferCacheOptions Angular Skip to main content
menu
close
more_horiz
menuAPI
@angular/common/http

HttpTransferCacheOptions

interface
stable

Options to configure how TransferCache should be used to cache requests made via HttpClient.

Configuring the caching options

On this page

    arrow_upward_alt Back to the top

    API

        
          interface HttpTransferCacheOptions {  filter?: ((req: HttpRequest<unknown>) => boolean) | undefined;  includeHeaders?: string[] | undefined;  includePostRequests?: boolean | undefined;  includeRequestsWithAuthHeaders?: boolean | undefined;  includeRequestsWithCredentials?: boolean | undefined;  includeNonCacheableRequests?: boolean | undefined;}
        
        

    filter

    ((req: HttpRequest<unknown>) => boolean) | undefined

    A function that receives a request as an argument and returns a boolean to indicate whether a request should be included into the cache.

    includeHeaders

    string[] | undefined

    Specifies which headers should be included into cached responses. No headers are included by default.

    includePostRequests

    boolean | undefined

    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).

    includeRequestsWithAuthHeaders

    boolean | undefined

    Enables caching of requests containing Authorization, Proxy-Authorization, or Cookie headers. By default, these requests are excluded from caching.

    includeRequestsWithCredentials

    boolean | undefined

    Enables caching of requests sent using withCredentials or Fetch API credentials modes (include or same-origin). By default, these requests are excluded from caching.

    includeNonCacheableRequests

    boolean | undefined

    Enables caching of requests and responses with Cache-Control directives that forbid caching (such as no-cache, no-store, or private), responses with a Set-Cookie header, or requests using Fetch API no-cache or no-store modes. By default, these requests/responses are excluded from caching.

    Jump to details

    Web Proxy Viewer  |  New URL  |  Original Page