bugfix: fix auth check return error msg

when your browse can not use cookie and you send a request with wrong token format in header,
in old code will return msg with cookie token is empty
in new code will return msg with auth header is invalid
it just is a small bug, and almost impossible to show up
This commit is contained in:
huchenhao
2021-02-15 22:50:43 +08:00
committed by GitHub
parent 1ee16f3a78
commit 6849a9157c

View File

@@ -608,7 +608,7 @@ func (mw *GinJWTMiddleware) jwtFromHeader(c *gin.Context, key string) (string, e
parts := strings.SplitN(authHeader, " ", 2)
if !(len(parts) == 2 && parts[0] == mw.TokenHeadName) {
return "", ErrInvalidAuthHeader
return "-", ErrInvalidAuthHeader
}
return parts[1], nil