From 2df2e3638fe2a2cc24ca4422626115e57a413ad4 Mon Sep 17 00:00:00 2001 From: Mitchell de Rijcke Date: Fri, 3 May 2019 12:00:03 +0200 Subject: [PATCH] Respect externalKey when removing session --- lib/context.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/context.js b/lib/context.js index 410996b..5d547af 100644 --- a/lib/context.js +++ b/lib/context.js @@ -279,7 +279,12 @@ class ContextSession { const externalKey = this.externalKey; if (externalKey) await this.store.destroy(externalKey); - ctx.cookies.set(key, '', opts); + + if (opts.externalKey) { + opts.externalKey.set(ctx, ''); + } else { + ctx.cookies.set(key, '', opts); + } } /**