0
0
llucycodes42
The @Injectable() decorator registers the YourInterceptor class as a HTTP interceptor. The intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> function takes a req object and returns an Observable that emits HttpEvent objects. The handle(req: HttpRequest<any>) function of the next object receives a req object and calls the handle() method of the HttpHandler object that was passed as an argument.
Library: angular
Shortcut: a_http_interceptor
import { Injectable } from '@angular/core';
import { HttpInterceptor, HttpEvent, HttpHandler, HttpRequest } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable()
export class YourInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(req);
}
}