Empty string check (#1101)

This commit is contained in:
田欧
2017-09-28 11:22:35 -05:00
committed by Bo-Yi Wu
parent f7376f7c7f
commit 3b300929e8
5 changed files with 11 additions and 12 deletions

View File

@ -24,7 +24,7 @@ type authPair struct {
type authPairs []authPair
func (a authPairs) searchCredential(authValue string) (string, bool) {
if len(authValue) == 0 {
if authValue == "" {
return "", false
}
for _, pair := range a {
@ -71,7 +71,7 @@ func processAccounts(accounts Accounts) authPairs {
assert1(len(accounts) > 0, "Empty list of authorized credentials")
pairs := make(authPairs, 0, len(accounts))
for user, password := range accounts {
assert1(len(user) > 0, "User can not be empty")
assert1(user != "", "User can not be empty")
value := authorizationHeader(user, password)
pairs = append(pairs, authPair{
Value: value,