Cosmetic changes

This commit is contained in:
Manu Mtz.-Almeida
2016-01-28 00:35:09 +01:00
parent 97cd894279
commit d64a1fb91c
5 changed files with 18 additions and 29 deletions

View File

@ -65,14 +65,10 @@ func BasicAuth(accounts Accounts) HandlerFunc {
}
func processAccounts(accounts Accounts) authPairs {
if len(accounts) == 0 {
panic("Empty list of authorized credentials")
}
assert1(len(accounts) > 0, "Empty list of authorized credentials")
pairs := make(authPairs, 0, len(accounts))
for user, password := range accounts {
if len(user) == 0 {
panic("User can not be empty")
}
assert1(len(user) > 0, "User can not be empty")
value := authorizationHeader(user, password)
pairs = append(pairs, authPair{
Value: value,