From 32bba9994b368642e63ab91d8f840e9324500a5f Mon Sep 17 00:00:00 2001 From: wdvxdr Date: Mon, 29 Mar 2021 12:28:43 +0800 Subject: [PATCH] fix: #768 --- server/http.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/http.go b/server/http.go index 15b4060..33a77b9 100644 --- a/server/http.go +++ b/server/http.go @@ -79,9 +79,10 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) { s.engine.Use(func(c *gin.Context) { auth := c.Request.Header.Get("Authorization") switch { - case auth != "" && strings.SplitN(auth, " ", 2)[1] != authToken: - c.AbortWithStatus(401) - return + case auth != "": + if strings.SplitN(auth, " ", 2)[1] != authToken { + c.AbortWithStatus(401) + } case c.Query("access_token") != authToken: c.AbortWithStatus(401) return