chore: update security.ts

This commit is contained in:
2025-11-28 15:40:18 +08:00
parent ae66e4450b
commit 9b234c5acc

View File

@@ -74,7 +74,9 @@ export const sanitizeResult = (data: any): any => {
export const verifyApiKey = (app: Elysia) => app.onBeforeHandle((ctx) => {
// 检查所有可能的Authorization头大小写变体
let authHeader: string | null = null;
for (const [key, value] of ctx.request.headers) {
// ts-ignore: 类型“Headers”上不存在属性“entries”。
for (const [key, value] of ctx.request.headers.entries()) {
if (key.toLowerCase() === 'authorization') {
authHeader = value;
break;