From a5fd1a0e653a0dacfe148077ec25fbe4449e005c Mon Sep 17 00:00:00 2001 From: Ryan Diehl Date: Wed, 24 Jun 2020 16:25:35 -0400 Subject: [PATCH] fix(properties): bypass http interceptors --- .../properties/src/lib/properties.service.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libs/utils/properties/src/lib/properties.service.ts b/libs/utils/properties/src/lib/properties.service.ts index 0b573a9..f75160b 100644 --- a/libs/utils/properties/src/lib/properties.service.ts +++ b/libs/utils/properties/src/lib/properties.service.ts @@ -1,4 +1,4 @@ -import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { HttpBackend, HttpClient, HttpHeaders } from '@angular/common/http'; import { Inject, Injectable, Injector, Optional } from '@angular/core'; import { NO_CACHE_HEADER } from '@psu/utils/browser'; import { LoadingEvents } from '@psu/utils/loading-events'; @@ -21,14 +21,19 @@ export class PropertiesService { public _properties: T; + private httpClient: HttpClient; + constructor( private log: Logger, - private httpClient: HttpClient, + httpBackend: HttpBackend, private injector: Injector, @Optional() @Inject(PROPERTIES_CONFIG) private config: PropertiesConfig - ) {} + ) { + // NOTE: This bypasses all HTTP interceptors, by design. + this.httpClient = new HttpClient(httpBackend); + } public load(appPropertyKey: string): Promise { const path = `${this.getBasePath()}${appPropertyKey}${propertiesExtension}`; @@ -37,12 +42,9 @@ export class PropertiesService { // params: { // d: new Date().getTime().toString() // }, - headers: new HttpHeaders().append(NO_CACHE_HEADER, 'true') + headers: new HttpHeaders().append(NO_CACHE_HEADER, 'true'), }) - .pipe( - tap(this.extractData.bind(this)), - catchError(this.handleError.bind(this)) - ) + .pipe(tap(this.extractData.bind(this)), catchError(this.handleError.bind(this))) .toPromise(); } -- GitLab