Files
api-worker/apps/worker/src/utils/request.ts
T
lsy 3bcc9ebb99 refactor(app): 管理台模块化并整理 worker API 类型
- 拆分管理台入口为 App/feature/core 结构并更新样式/配置
- 规范 worker 路由/中间件/服务类型与 JSON 解析
- 同步工具链与知识库记录
2026-02-16 00:48:49 +08:00

13 lines
358 B
TypeScript

import type { Context } from "hono";
/**
* Reads a bearer token from common headers.
*/
export function getBearerToken(c: Context): string | null {
const auth = c.req.header("Authorization");
if (auth?.toLowerCase().startsWith("bearer ")) {
return auth.slice(7).trim();
}
return c.req.header("x-api-key") ?? c.req.header("x-admin-token") ?? null;
}