diff --git a/goes.go b/goes.go index 99f7668..0bb5035 100644 --- a/goes.go +++ b/goes.go @@ -582,7 +582,7 @@ func (c *Client) AliasExists(alias string) (bool, error) { } func (c *Client) replaceHost(req *http.Request) { - + req.URL.User = c.Host.User req.URL.Scheme = c.Host.Scheme req.URL.Host = c.Host.Host } diff --git a/goes_test.go b/goes_test.go index a843c5d..da3f46d 100644 --- a/goes_test.go +++ b/goes_test.go @@ -44,6 +44,11 @@ func (s *GoesTestSuite) TestNewClient(c *C) { c.Assert(conn, DeepEquals, &Client{&url.URL{Scheme: "http", Host: ESHost + ":" + ESPort}, http.DefaultClient, ""}) } +func (s *GoesTestSuite) TestNewClientWithAuth(c *C) { + conn := NewClient("foo:bar@"+ESHost, ESPort) + c.Assert(conn, DeepEquals, &Client{&url.URL{Scheme: "http", User: url.UserPassword("foo", "bar"), Host: ESHost + ":" + ESPort}, http.DefaultClient, ""}) +} + func (s *GoesTestSuite) TestWithHTTPClient(c *C) { tr := &http.Transport{ DisableCompression: true,