Under my angular 5 app , I'm writing an interceptor service :
@Injectable()
export class myInterceptor implements HttpInterceptor {
constructor() { }
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const tokenInHeader = req.clone({setHeaders: {'version': '1LF'}});
return next.handle(tokenInHeader);
}
}
This is results on attaching the header "version" to all my http requests , which is not what i want
My purpose is how may i filter my https request by url with RegExp , and attach the "version" header to only the matching urls
Something like this :
request(new RegExp('^api/monitoring|^api/guiTrackers|^/api/monitoring|^/api/guiTrackers'))
Suggestions??