diff --git a/common/network_manager.go b/common/network_manager.go index a5c405180..7f63eb7aa 100644 --- a/common/network_manager.go +++ b/common/network_manager.go @@ -7,6 +7,7 @@ import ( "net" "net/url" "strconv" + "strings" "sync" "time" @@ -34,6 +35,15 @@ type Credentials struct { Password string `js:"password"` } +// IsEmpty returns true if the credentials are empty. +func (c Credentials) IsEmpty() bool { + c = Credentials{ + Username: strings.TrimSpace(c.Username), + Password: strings.TrimSpace(c.Password), + } + return c == (Credentials{}) +} + type metricInterceptor interface { urlTagName(urlTag string, method string) (string, bool) }