Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
5.7 KB
|
Line | |
---|
1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { Injectable, InjectionToken } from '@angular/core';
|
---|
9 | /**
|
---|
10 | * `HttpHandler` which applies an `HttpInterceptor` to an `HttpRequest`.
|
---|
11 | *
|
---|
12 | *
|
---|
13 | */
|
---|
14 | export class HttpInterceptorHandler {
|
---|
15 | constructor(next, interceptor) {
|
---|
16 | this.next = next;
|
---|
17 | this.interceptor = interceptor;
|
---|
18 | }
|
---|
19 | handle(req) {
|
---|
20 | return this.interceptor.intercept(req, this.next);
|
---|
21 | }
|
---|
22 | }
|
---|
23 | /**
|
---|
24 | * A multi-provider token that represents the array of registered
|
---|
25 | * `HttpInterceptor` objects.
|
---|
26 | *
|
---|
27 | * @publicApi
|
---|
28 | */
|
---|
29 | export const HTTP_INTERCEPTORS = new InjectionToken('HTTP_INTERCEPTORS');
|
---|
30 | export class NoopInterceptor {
|
---|
31 | intercept(req, next) {
|
---|
32 | return next.handle(req);
|
---|
33 | }
|
---|
34 | }
|
---|
35 | NoopInterceptor.decorators = [
|
---|
36 | { type: Injectable }
|
---|
37 | ];
|
---|
38 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJjZXB0b3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21tb24vaHR0cC9zcmMvaW50ZXJjZXB0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLFVBQVUsRUFBRSxjQUFjLE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