Skip to content

feat(http): add mode & redirect for fetch request in httpResource #62337

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

Closed

Conversation

SkyZeroZx
Copy link
Contributor

@SkyZeroZx SkyZeroZx commented Jun 27, 2025

Currently, Angular's httpResource doesn't expose the redirect and mode options from the underlying Fetch API.
Exposing these options would allow developers to control cross-origin behavior and redirect handling more explicitly, enabling better compliance with security policies and improving integration with external APIs.

Example new usage :

httpResource(() => ({
  url: '/api/register',
  method: 'POST',
  mode: 'cors',
  redirect: 'follow'
}));

This commit adds support for the Fetch API's mode & redirect options when using httpResource with the withFetch provider
@pullapprove pullapprove bot requested a review from crisbeto June 27, 2025 13:58
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: common/http Issues related to HTTP and HTTP Client labels Jun 27, 2025
@ngbot ngbot bot added this to the Backlog milestone Jun 27, 2025
Copy link
Contributor

@thePunderWoman thePunderWoman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

reviewed-for: fw-general, public-api

@thePunderWoman thePunderWoman added the target: minor This PR is targeted for the next minor release label Jun 27, 2025
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-for: public-api

@thePunderWoman thePunderWoman added the action: merge The PR is ready for merge by the caretaker label Jun 27, 2025
@thePunderWoman
Copy link
Contributor

This PR was merged into the repository by commit 27b7ec0.

The changes were merged into the following branches: main

AndrewKushnir added a commit to AndrewKushnir/angular that referenced this pull request Jun 27, 2025
AndrewKushnir added a commit to AndrewKushnir/angular that referenced this pull request Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: common/http Issues related to HTTP and HTTP Client detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants