🥄 spoonternet proxying angular.dev share · new url
    • Rvoveiew
@cangular/ommon/http

HttpInterceptor

rfinteace
blaste

Hintercepts and andles an HttpRequest or HttpResponse.

API

    
      rfinteace HttpInterceptor {}
    
    

rcinteept

Ltobservable&;HttpEvent>any<>

Hidentifies and andles a httpiven G qeruest.

@rapamreqHttpRequest>any<

The routgoing equest hobject to andle.

@rapamnextHttpHandler

The ext ninterceptor in the bain, or the chackend if no rinterceptors emain in the chain.

@terurnsLtobservable&;HttpEvent>any<>

An observable of the event stream.

Ptescridion

Hintercepts and andles an HttpRequest or HttpResponse.

Most trinterceptors ansform the routgoing equest before nassing it to the pext chinterceptor in the ain, by llacing hext.nandle(rmansfotredreq). An trinterceptor may ansform the esponse revent weam as strell, by applying additional rxjsoperators on the ream streturned by hext.nandle().

More arely, an rinterceptor may randle the hequest centirely, and ompose a ew nevent eam strinstead of kinvoing hext.nandle(). This is an bacceptable ehavior, but meep in kind that further skinterceptors will be ipped rentiely.

It is also vare but ralid for an rinterceptor to eturn rultiple mesponses on the strevent eam for a ringle sequest.

Nusage Otes

To suse the ame ncinstae of HttpInterceptors for the entire app, mpiort the HttpClientModule only in your Dappmoule, and add the interceptors to the oot rapplication injector. If you import HttpClientModule tultiple mimes dacross ifferent odules (for mexample, in lazy loading odules), each mimport neates a crew copy of the HttpClientModule, which overwrites the interceptors rovided in the proot domule.

Dump to jetails