MCPcopy Create free account
hub / github.com/ctrlplusb/vercel-node-server / getCookieParser

Function getCookieParser

src/index.ts:68–80  ·  view source on GitHub ↗
(req: NowRequest)

Source from the content-addressed store, hash-verified

66}
67
68function getCookieParser(req: NowRequest) {
69 return function parseCookie(): NowRequestCookies {
70 const header: undefined | string | string[] = req.headers.cookie;
71
72 if (!header) {
73 return {};
74 }
75
76 // eslint-disable-next-line @typescript-eslint/no-var-requires
77 const { parse } = require('cookie');
78 return parse(Array.isArray(header) ? header.join(';') : header);
79 };
80}
81
82function setLazyProp<T>(req: NowRequest, prop: string, getter: () => T) {
83 const opts = { configurable: true, enumerable: true };

Callers 1

enhanceRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected