10 lines
355 B
TypeScript
10 lines
355 B
TypeScript
import { makeParameterModifier } from "../Router.ts";
|
|
|
|
export default function auth() {
|
|
return makeParameterModifier(function (req) {
|
|
const res = req.headers.authorization;
|
|
if (typeof res !== 'string') return undefined;
|
|
if (res.startsWith('Bearer')) return res.substring(6).trimStart();
|
|
else return undefined;
|
|
});
|
|
} |