From 8f43fbd39973afdc6950c5e320c4218286fca5e6 Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Mon, 26 Jul 2021 11:54:25 +0200 Subject: [PATCH] check if correlationid exists before adding it as a header --- src/app/core/log/log.interceptor.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/core/log/log.interceptor.ts b/src/app/core/log/log.interceptor.ts index 773a60b6ef..bf843f1da8 100644 --- a/src/app/core/log/log.interceptor.ts +++ b/src/app/core/log/log.interceptor.ts @@ -5,6 +5,7 @@ import { Router } from '@angular/router'; import { Observable } from 'rxjs'; import { CookieService } from '../services/cookie.service'; +import { hasValue } from '../../shared/empty.util'; /** * Log Interceptor intercepting Http Requests & Responses to @@ -23,7 +24,9 @@ export class LogInterceptor implements HttpInterceptor { // Add headers from the intercepted request let headers = request.headers; - headers = headers.append('X-CORRELATION-ID', correlationId); + if (hasValue(correlationId)) { + headers = headers.append('X-CORRELATION-ID', correlationId); + } headers = headers.append('X-REFERRER', this.router.url); // Add new headers to the intercepted request