From 7232febf473e0e789197bfbdca89d39ed5e12de8 Mon Sep 17 00:00:00 2001 From: Josh Ponelat Date: Fri, 23 Sep 2016 16:19:11 +0200 Subject: [PATCH] add beforeUpdate hook --- lib/client-sessions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/client-sessions.js b/lib/client-sessions.js index a8d91ea..de92d65 100644 --- a/lib/client-sessions.js +++ b/lib/client-sessions.js @@ -471,6 +471,10 @@ Session.prototype = { // support for adding/removing cookie expires this.opts.cookie.expires = this.expires; + // Allow the user to do something just before the cookies is added to the headers + if(this.opts.beforeUpdate) { + this.opts.beforeUpdate(this); + } try { this.cookies.set(this.opts.cookieName, this.box(), this.opts.cookie); } catch (x) {