import { Injectable } from '@angular/core'; import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpHeaders } from '@angular/common/http'; import { IpServiceService } from './ipservice'; @Injectable() export class AuditBotInterceptor implements HttpInterceptor { constructor(private ip: IpServiceService) { } intercept(req: HttpRequest, next: HttpHandler) { debugger; if (req.url == this.ip.IP_ADDRESS_URL) { return next.handle(req); } else { var auditReq = req.clone(); if (sessionStorage.getItem('IPADDRESS')) { auditReq = auditReq.clone({ headers: auditReq.headers.set('IpAddress', sessionStorage.getItem('IPADDRESS')) }); } return next.handle(auditReq); } } }