Hello,
I need to add a http header to all http calls in order to provide security.
I wrote an angular interceptor that will add this header to all outgoing http calls.
It adds the header just fine to my services, but for the filemanager services, the header does not get added. I wonder if the file manager services do not go through the angular system? If so, how can I have my angular app added this security header to the service calls made by the file manager?
Here is my angular interceptor. The header does not get added to the file manager calls.
@Injectable()
export class BlobInterceptor implements HttpInterceptor {
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const token: string = localStorage.getItem('token');
request = request.clone({ headers: request.headers.set('Authorization', 'Bearer ' + token) });
return next.handle(request).pipe(
map((event: HttpEvent<any>) => {
if (event instanceof HttpResponse) {
console.log('event--->>>', event);
}
return event;
}));
}
}
Thank you.