Update from Angular 12, use "context", see this SO
I suggest that, in spite of check the request, you can use the header to add a "skip" property, if the header has the skip property, simple return the reqs
export class CustomInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (req.headers.get("skip"))
return next.handle(req);
....
}
}
And you make all the calls you need "skip" the interceptor like
this.http.get(url, {headers:{skip:"true"});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…