注册api

This commit is contained in:
2025-10-19 20:24:01 +08:00
parent 4cbb4bb859
commit 4e046021e3
9 changed files with 6541 additions and 177 deletions

View File

@@ -25,7 +25,7 @@ func AuthMiddleware(tokenService token.TokenService, userRepo repository.UserRep
// 授权标头的格式应为 "Bearer <token>"
parts := strings.Split(authHeader, " ")
if len(parts) != 2 || parts[0] != "Bearer" {
if len(parts) != 2 || strings.ToLower(parts[0]) != "bearer" {
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "授权标头格式不正确"})
return
}