(headers: {[key: string]: undefined | string | string[]})
| 114 | * @param req request object |
| 115 | */ |
| 116 | export 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 | |
| 128 | import Debug from "debug" |
| 129 | const debug = Debug("blitz:session") |