import { Injectable } from '@angular/core';
      import { HttpInterceptor, HttpEvent, HttpHandler, HttpRequest } from '@angular/common/http';
      import { Observable } from 'rxjs';
      export class YourInterceptor implements HttpInterceptor {
        intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
          return next.handle(req);
      Typescript language logo
      your recipe card header background

      Angular HTTP Interceptor Empty



      Jose Romero
      Angular TypeScript Recipes

      This code defines an interceptor that will be invoked when an HTTP request is received. The interceptor will be implementing the HttpInterceptor interface and will be handed the request object and the next handler function. The next handler function will be invoked with the request object and any errors generated by the request.

      Library: angular

      Shortcut: angular.http.interceptor


        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.