question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HttpClient/HttpRequest should support fetch API-specific redirect control

See original GitHub issue

šŸš€ feature request

Relevant Package

This feature request is for @angular/common/http

Description

#27689 requests a Fetch-based backend for HttpClient. The only response thus far has been ā€œfeel free to implement it yourselfā€. I don’t actually care what backend is used. I’m trying to replace my (fetch-based) back-end interactions with HttpClient so that I can use injected mocks for testing. The problem is that I currently use several features that are not available in the existing API, like the cache and redirect options in the Request and the redirected property of Response.

Describe the solution you’d like

I’d like to see first-class Angluar support for fetch-specific features.

Describe alternatives you’ve considered

I’m talking to back-end APIs that I have no control over. I’m either going to have to a) stick with fetch and figure out how to test my code on my own, or b) switch to HttpClient and rewrite significant portions of my backend interactions to detect and handle redirects that I could have avoided using a simple {redirect: "error"} via native fetch.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
alxhubcommented, May 29, 2020

I’d like to see first-class Angluar support for fetch-specific features.

I would too 😃

When it was in development, HttpClient was initially based on fetch, but ran into some issues around browser support (like IE, as always) and around specific features such as cancellation, progress reports, etc.

I think it’s a good time for us to re-evaluate what a fetch-based HttpBackend might look like. There are still some challenges here (implementing the progress events HttpClient exposes on top of fetch would be tricky, how do you intercept a ReadableStream, etc) but I think it might be doable, even if it’s opt-in for now.

1reaction
thw0rtedcommented, May 31, 2020

I should have guessed legacy support was the culprit. Is there an existing ticket for ā€œDrop IE support, raze it to the foundations, and salt the ashesā€ or should I open a new one?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fetch API - What's the use of redirect: manual - Stack Overflow
The short answer is: unless you're doing something with service-worker code like what https://github.com/whatwg/fetch/issues/66 covers,Ā ...
Read more >
Response.redirected - Web APIs - MDN Web Docs
The read-only redirected property of the Response interface indicates whether or not the response is the result of a request you made which...
Read more >
Fetch Standard
The goal is to unify fetching across the web platform and provide consistent handling of everything that involves, including: URL schemesĀ ...
Read more >
Browser content redirection policy settings | Reference
Browser content redirection controls and optimizes the way Citrix ... You must configure browser content redirection for server fetch modeĀ ...
Read more >
ERR_TOO_MANY_REDIRECTS Ā· Cloudflare SSL/TLS docs
This error occurs when visitors get stuck in a redirect loop. ... Your domain's SSL/TLS Encryption mode controls how Cloudflare connects toĀ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found