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:
- Created 3 years ago
- Reactions:4
- Comments:9 (4 by maintainers)
I would too š
When it was in development,
HttpClient
was initially based onfetch
, 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
-basedHttpBackend
might look like. There are still some challenges here (implementing the progress eventsHttpClient
exposes on top offetch
would be tricky, how do you intercept aReadableStream
, etc) but I think it might be doable, even if itās opt-in for now.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?