Angular: How to know if request has been cancelled in HttpClient

后端 未结 4 1427
走了就别回头了
走了就别回头了 2021-01-01 05:32

To know if a request has completed, I do if (httpEvent instanceof HttpResponse). Likewise, how to know if a request is cancelled in HttpInterceptor

4条回答
  •  时光取名叫无心
    2021-01-01 05:52

    It seems like angular ignores the abort event. Here is the Angular sources: https://github.com/angular/angular/blob/5.0.1/packages/common/http/src/xhr.ts

    The returned Observable does notifiy subscribers if the request is aborted.

提交回复
热议问题