From 262ac0e9a57cd728a9e4035a54879e8459b5eabd Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Sun, 7 Jan 2024 19:40:42 +0800 Subject: [PATCH] add header for basic auth --- api/middleware.go | 1 + 1 file changed, 1 insertion(+) diff --git a/api/middleware.go b/api/middleware.go index c350b1c..27202c3 100644 --- a/api/middleware.go +++ b/api/middleware.go @@ -36,6 +36,7 @@ func mwBasicAuth(auther auth.Authenticator) gin.HandlerFunc { } u, p, _ := c.Request.BasicAuth() if _, ok := auther.Authenticate(c, u, p); !ok { + c.Writer.Header().Set("WWW-Authenticate", "Basic") c.AbortWithStatus(http.StatusUnauthorized) } }