Angular cancels http requests very fast and I want to intercept those cancelled requests. Is it possible to capture cancelled requests in the interceptor? Below is a fragment of my interceptor code, where I want to catch cancelled request.
intercept(req: HttpRequest<any>, next: HttpHandler):
Observable<HttpEvent<any>> {
this.onStartRequest();
// Pass the cloned request instead of the original request to the next handle
return next.handle(req).do(
(event: HttpEvent<any>) => {
if (event instanceof HttpResponse) {
// do something
}
},
(err: any) => {
if (err instanceof HttpErrorResponse) {
// do something
}
}
);
}