diff options
Diffstat (limited to 'catalog-ui/src/app/ng2/http-interceptor/headers-interceptor.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/http-interceptor/headers-interceptor.ts | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/catalog-ui/src/app/ng2/http-interceptor/headers-interceptor.ts b/catalog-ui/src/app/ng2/http-interceptor/headers-interceptor.ts index 00e2fd8fcd..d548d425a2 100644 --- a/catalog-ui/src/app/ng2/http-interceptor/headers-interceptor.ts +++ b/catalog-ui/src/app/ng2/http-interceptor/headers-interceptor.ts @@ -14,11 +14,19 @@ export class HeadersInterceptor implements HttpInterceptor { constructor(private injector: Injector, private cookieService: Cookie2Service, private httpHelperService: HttpHelperService) {} intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { - let authReq = req.clone({ headers: req.headers.set(this.cookieService.getUserIdSuffix(), this.cookieService.getUserId()) - .set('Content-Type', 'application/json; charset=UTF-8') - .set(this.cookieService.getUserIdSuffix(), this.cookieService.getUserId()) - .set(this.cookieService.getUserIdSuffix(), this.cookieService.getUserId()) - }); + let authReq: HttpRequest<any>; + if (req.body instanceof FormData) { + authReq = req.clone({ headers: req.headers.set(this.cookieService.getUserIdSuffix(), this.cookieService.getUserId()) + .set(this.cookieService.getUserIdSuffix(), this.cookieService.getUserId()) + .set(this.cookieService.getUserIdSuffix(), this.cookieService.getUserId()) + }); + } else { + authReq = req.clone({ headers: req.headers.set(this.cookieService.getUserIdSuffix(), this.cookieService.getUserId()) + .set('Content-Type', 'application/json; charset=UTF-8') + .set(this.cookieService.getUserIdSuffix(), this.cookieService.getUserId()) + .set(this.cookieService.getUserIdSuffix(), this.cookieService.getUserId()) + }); + } const uuidValue = this.httpHelperService.getUuidValue(authReq.url); if (uuidValue !== '') { |