13 lines
264 B
TypeScript
13 lines
264 B
TypeScript
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];
|
|
}
|