From c5f842b4093072e14fd570941c508066f38eef5e Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Sun, 14 May 2023 22:13:17 +0200 Subject: [PATCH] just remove session cookie, if its set --- mod.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mod.ts b/mod.ts index 83680ad..1bb5626 100644 --- a/mod.ts +++ b/mod.ts @@ -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 } }