Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(http): add support for fetch mode and redirect options in HttpCl…#62315

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
SkyZeroZx wants to merge1 commit intoangular:mainfromSkyZeroZx:add-fetch-control

Conversation

SkyZeroZx
Copy link
Contributor

This commit adds support for the Fetch API'smode andredirect options when usingHttpClient with thewithFetch provider.

The change includes:

  • Addedmode andredirect to theHttpRequestInit interface
  • ModifiedFetchBackend to pass the options
  • Modifed in simple function in xhr to show warning messages
  • Added unit tests to validate behavior

Motivation / Use Cases

Themode andredirect options are particularly useful for:

  • mode controls the request's CORS policy ('cors', 'no-cors', 'same-origin'), helping manage security boundaries and cross-origin resource sharing.

  • redirect determines how redirects are handled ('follow', 'manual', 'error'), allowing developers to explicitly accept, reject, or handle redirections manually.

  • These options help ensure secure data access across origins, enforce strict network policies, and give developers more control over how external resources are handled.


Proposed Solution

  • Addmode andredirect to theHttpRequestInit interface
  • Implement property handling in theHttpRequest class
  • Pass the options throughFetchBackend to the native Fetch API
  • Maintain full backward compatibility

Examples of New Usage

// POST request with mode and redirecthttp.post('/api/register',{mode:'same-origin',redirect :'follow',}).subscribe();

@pullapprovepullapprovebot requested a review fromalxhubJune 27, 2025 03:17
@angular-robotangular-robotbot added detected: featurePR contains a feature commit area: common/httpIssues related to HTTP and HTTP Client labelsJun 27, 2025
@ngbotngbotbot added this to theBacklog milestoneJun 27, 2025
Copy link
Contributor

@thePunderWomanthePunderWoman left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

reviewed-for: fw-general, public-api

Copy link
Member

@crisbetocrisbeto 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

@thePunderWomanthePunderWoman added target: minorThis PR is targeted for the next minor release action: mergeThe PR is ready for merge by the caretaker labelsJun 27, 2025
@alan-agius4alan-agius4 added action: cleanupThe PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: mergeThe PR is ready for merge by the caretaker labelsJun 27, 2025
@JeanMecheJeanMecheforce-pushed theadd-fetch-control branch 2 times, most recently fromaf458f9 to93cc91aCompareJune 27, 2025 12:24
@thePunderWomanthePunderWoman added action: mergeThe PR is ready for merge by the caretaker and removed action: cleanupThe PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labelsJun 27, 2025
…ientAdd support for mode and redirect options in Angular's HttpClient based on fech provider to enable control CORS behavior and redirect handling
@thePunderWoman
Copy link
Contributor

This PR was merged into the repository by commit8732244.

The changes were merged into the following branches: main

AndrewKushnir added a commit to AndrewKushnir/angular that referenced this pull requestJun 27, 2025
AndrewKushnir added a commit to AndrewKushnir/angular that referenced this pull requestJun 27, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@alan-agius4alan-agius4alan-agius4 left review comments

@thePunderWomanthePunderWomanthePunderWoman approved these changes

@crisbetocrisbetocrisbeto approved these changes

Assignees
No one assigned
Labels
action: mergeThe PR is ready for merge by the caretakerarea: common/httpIssues related to HTTP and HTTP Clientdetected: featurePR contains a feature committarget: minorThis PR is targeted for the next minor release
Projects
None yet
Milestone
Backlog
Development

Successfully merging this pull request may close these issues.

4 participants
@SkyZeroZx@thePunderWoman@crisbeto@alan-agius4

[8]ページ先頭

©2009-2025 Movatter.jp