diff --git a/CHANGELOG.md b/CHANGELOG.md index 0afe5b532d..720f129799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ - [#2386](https://github.com/influxdb/influxdb/pull/2386): Fix shard datanodes stats getting appended too many times - [#2393](https://github.com/influxdb/influxdb/pull/2393): Fix default hostname for connecting to cluster. - [#2390](https://github.com/influxdb/influxdb/pull/2393): Handle large sums when calculating means - thanks @neonstalwart! +- [#2391](https://github.com/influxdb/influxdb/pull/2391): Unable to write points through Go client when authentication enabled +- [#2400](https://github.com/influxdb/influxdb/pull/2400): Always send auth headers for client requests if present ## v0.9.0-rc26 [04-21-2015] diff --git a/client/influxdb.go b/client/influxdb.go index b7e2605db4..5f9b1f781a 100644 --- a/client/influxdb.go +++ b/client/influxdb.go @@ -122,6 +122,10 @@ func (c *Client) Write(bp BatchPoints) (*Response, error) { } req.Header.Set("Content-Type", "application/json") req.Header.Set("User-Agent", c.userAgent) + if c.username != "" { + req.SetBasicAuth(c.username, c.password) + } + resp, err := c.httpClient.Do(req) if err != nil { return nil, err @@ -155,6 +159,10 @@ func (c *Client) Ping() (time.Duration, string, error) { return 0, "", err } req.Header.Set("User-Agent", c.userAgent) + if c.username != "" { + req.SetBasicAuth(c.username, c.password) + } + resp, err := c.httpClient.Do(req) if err != nil { return 0, "", err @@ -170,8 +178,6 @@ func (c *Client) Dump(db string) (io.ReadCloser, error) { u.Path = "dump" values := u.Query() values.Set("db", db) - values.Set("user", c.username) - values.Set("password", c.password) u.RawQuery = values.Encode() req, err := http.NewRequest("GET", u.String(), nil) @@ -179,6 +185,10 @@ func (c *Client) Dump(db string) (io.ReadCloser, error) { return nil, err } req.Header.Set("User-Agent", c.userAgent) + if c.username != "" { + req.SetBasicAuth(c.username, c.password) + } + resp, err := c.httpClient.Do(req) if err != nil { return nil, err