diff --git a/src/portal/src/app/intercept-http.service.spec.ts b/src/portal/src/app/intercept-http.service.spec.ts index 4fe3c7b0f..319d577f6 100644 --- a/src/portal/src/app/intercept-http.service.spec.ts +++ b/src/portal/src/app/intercept-http.service.spec.ts @@ -24,7 +24,7 @@ describe('InterceptHttpService', () => { return of(new HttpResponse({status: 200})); } else { return throwError(new HttpResponse( { - status: 403 + status: 422 })); } } @@ -48,7 +48,7 @@ describe('InterceptHttpService', () => { (service: InterceptHttpService) => { mockCookieService.set("fdsa|ds"); service.intercept(mockRequest, mockHandle).subscribe(res => { - if (res.status === 403) { + if (res.status === 422) { expect(btoa(mockRequest.headers.get("X-Xsrftoken"))).toEqual(cookie.split("|")[0]); } else { expect(res.status).toEqual(200); diff --git a/src/portal/src/app/intercept-http.service.ts b/src/portal/src/app/intercept-http.service.ts index ae08e35df..cc8f6c572 100644 --- a/src/portal/src/app/intercept-http.service.ts +++ b/src/portal/src/app/intercept-http.service.ts @@ -14,7 +14,7 @@ export class InterceptHttpService implements HttpInterceptor { intercept(request: HttpRequest, next: HttpHandler): Observable { return next.handle(request).pipe(catchError(error => { - if (error.status === 403) { + if (error.status === 422) { let Xsrftoken = this.cookie.get("_xsrf") ? atob(this.cookie.get("_xsrf").split("|")[0]) : null; if (Xsrftoken && !request.headers.has('X-Xsrftoken')) { request = request.clone({ headers: request.headers.set('X-Xsrftoken', Xsrftoken) });