boxlang-express 0.1.19
Released .
- Added
resave/saveUninitializedoptions toboxExpressSession(), mirroring express-session's own options of the same name. By default this middleware writes to the store on every request, even one that never reads or touchesreq.session— free against the default in-memory store, a real cost against anything out-of-process.saveUninitialized: falseskips both the store write and theSet-Cookiefor a new session that was never modified;resave: falseskips the store write (cookie still refreshed) for an existing session that wasn't modified. A session that is modified is always saved regardless of either option. Both default totrue(the historical behavior), so this doesn't change anything for existing consumers unless they opt in. See Session.bx. - Added
Response.onBeforeSend(callback)— registers a callback that runs once, synchronously, the instant before headers are actually flushed. Needed to implementsaveUninitializedcorrectly: whether to send a session cookie can depend on whatnext()did toreq.session, but by the timenext()returns to a middleware's own frame, a terminal handler further down the chain has normally already called_end()and flushed the headers — too late to add one there. The same techniqueexpress-sessionuses via monkey-patchingres.end, done explicitly here since BoxLang can't intercept it that way. See Response.bx.