Content-Length: 268811 | pFad | http://github.com/angular/angular/pull/61766

CC feat(http): Add support for fetch request cache and priority options by SkyZeroZx · Pull Request #61766 · angular/angular · GitHub
Skip to content

feat(http): Add support for fetch request cache and priority options #61766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SkyZeroZx
Copy link
Contributor

This commit adds support for the Fetch API's cache and priority options when using HttpClient with the withFetch provider.

The change includes:

  • Added cache and priority to the HttpRequestInit interface
  • Modified FetchBackend to pass the options
  • Added unit tests to validate behavior

Motivation / Use Cases

The cache and priority options are particularly useful for:

  • Controlling how HTTP requests are cached (cache: 'no-store', 'reload', etc.)
  • Suggesting the relative priority of resource loading to the browser (priority: 'high', 'low', 'auto')
  • Improving performance metrics (e.g., LCP) by prioritizing critical assets
  • Reducing unnecessary network traffic for cached resources

Proposed Solution

  • Add cache and priority to the HttpRequestInit interface
  • Implement property handling in the HttpRequest class
  • Pass the options through FetchBackend to the native Fetch API
  • Maintain full backward compatibility

Examples of New Usage

// GET request with cache and priority
http.get('/assets/hero-image.jpg', {
  cache: 'force-cache',
  priority: 'high'
}).subscribe();

@pullapprove pullapprove bot requested a review from kirjs May 30, 2025 02:17
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: common/http Issues related to HTTP and HTTP Client labels May 30, 2025
@ngbot ngbot bot added this to the Backlog milestone May 30, 2025
@SkyZeroZx SkyZeroZx force-pushed the add-fetch-performance branch from 6d1388c to ef37d29 Compare May 30, 2025 04:26
Enhances Angular HttpClient requests with Fetch API cache and priority options to optimize loading and performance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: common/http Issues related to HTTP and HTTP Client detected: feature PR contains a feature commit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/angular/angular/pull/61766

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy