MCPcopy
hub / github.com/blitz-js/blitz / getCookieParser

Function getCookieParser

packages/blitz-auth/src/server/auth-sessions.ts:116–126  ·  view source on GitHub ↗
(headers: {[key: string]: undefined | string | string[]})

Source from the content-addressed store, hash-verified

114 * @param req request object
115 */
116export function getCookieParser(headers: {[key: string]: undefined | string | string[]}) {
117 return function parseCookie() {
118 const header: undefined | string | string[] = headers.cookie
119
120 if (!header) {
121 return {}
122 }
123
124 return parse(Array.isArray(header) ? header.join(";") : header)
125 }
126}
127
128import Debug from "debug"
129const debug = Debug("blitz:session")

Callers

nothing calls this directly

Calls 1

parseFunction · 0.85

Tested by

no test coverage detected