import type { IncomingHttpHeaders } from 'http'; type Request = { headers: IncomingHttpHeaders; }; export function getToken({ headers }: Request) { return headers.cookie ?.split(';') .find((c) => c.trim().startsWith('token=')) ?.split('=')[1]; }