chore: rename context name

This commit is contained in:
Steven
2023-09-17 16:21:11 +08:00
parent 75d152922e
commit 6cb493b4a1
8 changed files with 23 additions and 23 deletions

View File

@ -17,7 +17,7 @@ import (
const (
// The key name used to store user id in the context
// user id is extracted from the jwt token subject field.
UserIDContextKey = "user-id"
userIDContextKey = "user-id"
)
func extractTokenFromHeader(c echo.Context) (string, error) {
@ -122,7 +122,7 @@ func JWTMiddleware(s *APIV1Service, next echo.HandlerFunc, secret string) echo.H
}
// Stores userID into context.
c.Set(UserIDContextKey, userID)
c.Set(userIDContextKey, userID)
return next(c)
}
}