feat: 支持从 x-goog-api-key header 中获取授权密钥

This commit is contained in:
RedwindA
2025-06-04 07:58:09 +08:00
parent b366bf585c
commit c71255461d

View File

@@ -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)