docs: incorporate review feedback (#26827)

PR Close #26827
This commit is contained in:
Vani 2018-12-10 10:53:40 -08:00 committed by Miško Hevery
parent aa8d0809d3
commit 8accc98d28
1 changed files with 15 additions and 5 deletions

View File

@ -16,13 +16,13 @@ import {HttpEvent} from './response';
/**
* Intercepts `HttpRequest` or `HttpResponse` and handles them.
*
* Most interceptors transforms the outgoing request before passing it to the
* Most interceptors transform the outgoing request before passing it to the
* next interceptor in the chain, by calling `next.handle(transformedReq)`.
* An interceptor may choose to transform the
* response event stream as well, by applying additional Rx operators on the stream
* An interceptor may transform the
* response event stream as well, by applying additional RxJS operators on the stream
* returned by `next.handle()`.
*
* More rarely, an interceptor may choose to handle the request itself completely,
* More rarely, an interceptor may handle the request entirely,
* and compose a new event stream instead of invoking `next.handle()`. This is an
* acceptable behavior, but keep in mind that further interceptors will be skipped entirely.
*
@ -31,11 +31,21 @@ import {HttpEvent} from './response';
*
* @publicApi
*
* @see [HTTP Guide](guide/http#intercepting-requests-and-responses)
*
* @usageNotes
*
* To use the same instance of `HttpInterceptors` for the entire app, import the `HttpClientModule`
* only in your `AppModule`, and add the interceptors to the root application injector .
* If you import `HttpClientModule` multiple times across different modules (for example, in lazy
* loading modules), each import creates a new copy of the `HttpClientModule`, which overwrites the interceptors
* provided in the root module.
*
*/
export interface HttpInterceptor {
/**
* * **req**: The outgoing request to handle
* * **next**: The next interceptor in the chain
* * **next**: The next interceptor in the chain, or the backend if no interceptors in the chain.
*
*/
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;