chore: update security.ts
This commit is contained in:
@@ -74,7 +74,9 @@ export const sanitizeResult = (data: any): any => {
|
|||||||
export const verifyApiKey = (app: Elysia) => app.onBeforeHandle((ctx) => {
|
export const verifyApiKey = (app: Elysia) => app.onBeforeHandle((ctx) => {
|
||||||
// 检查所有可能的Authorization头大小写变体
|
// 检查所有可能的Authorization头大小写变体
|
||||||
let authHeader: string | null = null;
|
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') {
|
if (key.toLowerCase() === 'authorization') {
|
||||||
authHeader = value;
|
authHeader = value;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user