From 6849a9157c981faf14e4b8a1a468badc34c80759 Mon Sep 17 00:00:00 2001 From: huchenhao Date: Mon, 15 Feb 2021 22:50:43 +0800 Subject: [PATCH] bugfix: fix auth check return error msg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkg/jwtauth/jwtauth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/jwtauth/jwtauth.go b/pkg/jwtauth/jwtauth.go index bc43b30..d2bf9bc 100644 --- a/pkg/jwtauth/jwtauth.go +++ b/pkg/jwtauth/jwtauth.go @@ -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