diff --git a/auth.go b/auth.go index 9ed81b5d..36f2fdee 100644 --- a/auth.go +++ b/auth.go @@ -7,6 +7,7 @@ package gin import ( "crypto/subtle" "encoding/base64" + "fmt" "net/http" "strconv" ) @@ -83,7 +84,7 @@ func processAccounts(accounts Accounts) authPairs { } func authorizationHeader(user, password string) string { - base := user + ":" + password + base := fmt.Sprintf("%s:%s", user, password) return "Basic " + base64.StdEncoding.EncodeToString([]byte(base)) }