MCPcopy
hub / github.com/tinyhttp/tinyhttp / shouldsetCookie

Function shouldsetCookie

packages/session/src/index.ts:341–348  ·  view source on GitHub ↗
(sessionID?: string | boolean | undefined, session?: Session)

Source from the content-addressed store, hash-verified

339 const isSaved = (sess: Session) => originalId === sess.id && savedHash === hash(session)
340
341 function shouldsetCookie(sessionID?: string | boolean | undefined, session?: Session) {
342 // cannot set cookie without a session ID
343 if (typeof sessionID !== 'string' || !session) return false
344
345 return cookieId !== sessionID
346 ? saveUninitialized || isModified(session)
347 : rolling || (session.cookie.expires != null && isModified(session))
348 }
349
350 // determine if session should be saved to store
351 function shouldSave(id?: string, session?: Session) {

Callers 1

SessionManagerFunction · 0.85

Calls 1

isModifiedFunction · 0.85

Tested by

no test coverage detected