chore: update the result of CR (#2354)

* chore: update the result of CR

* Update utils.go

* Update utils.go

* Update context.go

* Update context.go
This commit is contained in:
thinkerou
2020-05-04 11:40:41 +08:00
committed by GitHub
parent abc4fa0718
commit 54175dbe72
6 changed files with 16 additions and 10 deletions

View File

@ -70,8 +70,9 @@ func BasicAuth(accounts Accounts) HandlerFunc {
}
func processAccounts(accounts Accounts) authPairs {
assert1(len(accounts) > 0, "Empty list of authorized credentials")
pairs := make(authPairs, 0, len(accounts))
length := len(accounts)
assert1(length > 0, "Empty list of authorized credentials")
pairs := make(authPairs, 0, length)
for user, password := range accounts {
assert1(user != "", "User can not be empty")
value := authorizationHeader(user, password)