Add condiction if withCredentials in order to add cookie in the request.

This commit is contained in:
Konstantinos Triantafyllou 2022-12-23 17:56:47 +02:00
parent 789a0225fa
commit e0c45b1065
1 changed files with 3 additions and 1 deletions

View File

@ -36,7 +36,9 @@ export class HttpInterceptorService implements HttpInterceptor {
} else {
if (isPlatformServer(this.platformId)) {
let headers = new HttpHeaders();
headers = headers.set('Cookie', this.req.get('Cookie'));
if(request.withCredentials) {
headers = headers.set('Cookie', this.req.get('Cookie'));
}
const authReq = request.clone({
headers: headers
});