your recipe card header background

    Angular HTTP Interceptor Empty

    0

    0

    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

    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);
      }
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.