wheelshare-old-backend/src/getSessionID.ts
2021-04-10 16:28:39 -04:00

11 lines
283 B
TypeScript

import { IncomingMessage } from 'http';
export default function getSessionID(request: IncomingMessage): string | null {
const auth = request.headers.authorization;
if (typeof auth === 'string' && auth.startsWith('Bearer ')) {
return auth.slice(7);
} else {
return null;
}
}