From 76d5e730f7087e9438ed7b5a0825315bdd419423 Mon Sep 17 00:00:00 2001 From: RikiyaFujii Date: Sun, 25 Nov 2018 15:20:29 +0900 Subject: [PATCH] refactoring --- auth.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)) }