HttpHandler

把一个 HttpRequest 转换成 HttpEvent 组成的流,HttpResponse 就是其中之一。

Transforms an HttpRequest into a stream of HttpEvents, one of which will likely be a HttpResponse.

查看"说明"...

      
      abstract class HttpHandler {
  abstract handle(req: HttpRequest<any>): Observable<HttpEvent<any>>
}
    

说明

HttpHandler 是可注入的。当被注入时,该处理器的实例会把请求派发给拦截器链中的第一个拦截器,第一个拦截器会再派发给第二个拦截器,以此类推。 最终抵达 HttpBackend

HttpHandler is injectable. When injected, the handler instance dispatches requests to the first interceptor in the chain, which dispatches to the second, etc, eventually reaching the HttpBackend.

HttpInterceptor 中,HttpHandler 参数就表示链中的下一个拦截器。

In an HttpInterceptor, the HttpHandler parameter is the next interceptor in the chain.

方法

abstract handle(req: HttpRequest<any>): Observable<HttpEvent<any>>
      
      abstract handle(req: HttpRequest<any>): Observable<HttpEvent<any>>
    
参数
req HttpRequest
返回值

Observable<HttpEvent<any>>