MCPcopy Create free account
hub / github.com/code-pushup/cli / getCookie

Function getCookie

e2e/plugin-axe-e2e/mocks/fixtures/auth/server/server.ts:13–17  ·  view source on GitHub ↗
(req: IncomingMessage, name: string)

Source from the content-addressed store, hash-verified

11const SESSION_COOKIE = 'session=authenticated';
12
13function getCookie(req: IncomingMessage, name: string): string | undefined {
14 const cookies = req.headers.cookie?.split(';').map(c => c.trim()) ?? [];
15 const cookie = cookies.find(c => c.startsWith(`${name}=`));
16 return cookie?.split('=')[1];
17}
18
19function isAuthenticated(req: IncomingMessage): boolean {
20 return getCookie(req, 'session') === 'authenticated';

Callers 1

isAuthenticatedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected