just remove session cookie, if its set

This commit is contained in:
HorizonCode 2023-05-14 22:13:17 +02:00
parent 46cf6081af
commit c5f842b409

5
mod.ts
View File

@ -308,7 +308,9 @@ export class HTTPServer {
maxAge: this.settings.sessionExpire ?? undefined,
});
} else {
routeReply.cookie("session", undefined);
if (routeRequest.cookie("session")) {
routeReply.cookie("session", undefined);
}
}
}
}
@ -468,6 +470,7 @@ export class RouteRequest {
try {
this.session = JSON.parse(decodedSessionCookie);
} catch (_err) {
console.log(_err);
// Ignore if sessionCookie is not in JSON format
}
}