Remove usage of http.DefaultClient

This commit is contained in:
Jeff Mitchell 2015-10-16 17:17:35 -04:00
parent 3fa57e61ba
commit 3c0ed11922
2 changed files with 7 additions and 4 deletions

View File

@ -83,7 +83,8 @@ func (c *AtlasClient) Get() (*Payload, error) {
}
// Request the url
resp, err := http.DefaultClient.Do(req)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return nil, err
}
@ -161,7 +162,8 @@ func (c *AtlasClient) Put(state []byte) error {
req.ContentLength = int64(len(state))
// Make the request
resp, err := http.DefaultClient.Do(req)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return fmt.Errorf("Failed to upload state: %v", err)
}
@ -186,7 +188,8 @@ func (c *AtlasClient) Delete() error {
}
// Make the request
resp, err := http.DefaultClient.Do(req)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return fmt.Errorf("Failed to delete state: %v", err)
}

View File

@ -24,7 +24,7 @@ func TestHTTPClient(t *testing.T) {
t.Fatalf("err: %s", err)
}
client := &HTTPClient{URL: url, Client: http.DefaultClient}
client := &HTTPClient{URL: url, Client: &http.Client{}}
testClient(t, client)
}