From c71255461d5d5ca32eedff0af710b4d8e9e76107 Mon Sep 17 00:00:00 2001 From: RedwindA Date: Wed, 4 Jun 2025 07:58:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E4=BB=8E=20x-goog-ap?= =?UTF-8?q?i-key=20header=20=E4=B8=AD=E8=8E=B7=E5=8F=96=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E5=AF=86=E9=92=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- middleware/auth.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/middleware/auth.go b/middleware/auth.go index ce86bb36..f387029f 100644 --- a/middleware/auth.go +++ b/middleware/auth.go @@ -189,6 +189,11 @@ func TokenAuth() func(c *gin.Context) { if skKey != "" { c.Request.Header.Set("Authorization", "Bearer "+skKey) } + // 从x-goog-api-key header中获取key + xGoogKey := c.Request.Header.Get("x-goog-api-key") + if xGoogKey != "" { + c.Request.Header.Set("Authorization", "Bearer "+xGoogKey) + } } key := c.Request.Header.Get("Authorization") parts := make([]string, 0)