'Angular interceptor 302 response
I am adding a http interceptor in an existing Angular 11 app.
We have 2 resquests onload, they work as expected but when I add the interceptor with no logic, just return the same request, one request starts throwing 302 found status.
So, I dont understand how I should fix this or if there is a walk-around.
Thanks for your help
import { Injectable } from '@angular/core'; import { HttpInterceptor, HttpEvent, HttpResponse, HttpRequest, HttpHandler } from '@angular/common/http'; import { Observable } from 'rxjs';
@Injectable() export class MyInterceptor implements HttpInterceptor { intercept(httpRequest: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(httpRequest); } }
Solution 1:[1]
I think you missed something. Please view carefully this article and then check. I hope this will work for you https://ultimatecourses.com/blog/intro-to-angular-http-interceptors
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Eitzaz shah |
