Update vendored atlas client

This commit is contained in:
James Bardin 2016-07-22 10:22:46 -04:00
parent f66d1a10a4
commit 640c3a891f
2 changed files with 17 additions and 6 deletions

View File

@ -70,6 +70,10 @@ type Client struct {
// HTTPClient is the underlying http client with which to make requests.
HTTPClient *http.Client
// DefaultHeaders is a set of headers that will be added to every request.
// This minimally includes the atlas user-agent string.
DefaultHeader http.Header
}
// DefaultClient returns a client that connects to the Atlas API.
@ -110,8 +114,11 @@ func NewClient(urlString string) (*Client, error) {
client := &Client{
URL: parsedURL,
Token: token,
DefaultHeader: make(http.Header),
}
client.DefaultHeader.Set("User-Agent", userAgent)
if err := client.init(); err != nil {
return nil, err
}
@ -227,10 +234,12 @@ func (c *Client) rawRequest(verb string, u *url.URL, ro *RequestOptions) (*http.
return nil, err
}
// Set the User-Agent
request.Header.Set("User-Agent", userAgent)
// set our default headers first
for k, v := range c.DefaultHeader {
request.Header[k] = v
}
// Add any headers (auth will be here if set)
// Add any request headers (auth will be here if set)
for k, v := range ro.Headers {
request.Header.Add(k, v)
}

4
vendor/vendor.json vendored
View File

@ -920,9 +920,11 @@
"revision": "95fa852edca41c06c4ce526af4bb7dec4eaad434"
},
{
"checksumSHA1": "EWGfo74RcoKaYFZNSkvzYRJMgrY=",
"comment": "20141209094003-92-g95fa852",
"path": "github.com/hashicorp/atlas-go/v1",
"revision": "95fa852edca41c06c4ce526af4bb7dec4eaad434"
"revision": "c8b26aa95f096efc0f378b2d2830ca909631d584",
"revisionTime": "2016-07-22T13:58:36Z"
},
{
"comment": "v0.6.3-28-g3215b87",