How to make an angular module to ignore http interceptor added in a core module

You can use HttpBackend.

Example:

import { HttpClient, ..., HttpBackend } from '@angular/common/http';

@Injectable()
export class TestService {

  private httpClient: HttpClient;

  constructor( handler: HttpBackend) { 
     this.httpClient = new HttpClient(handler);
  }
....

In this way the service is not intercepted by AuthInterceptor.

Leave a Comment