From 3c0ed11922f17bb48ac14c76e3242070d3b82f2e Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Fri, 16 Oct 2015 17:17:35 -0400 Subject: [PATCH] Remove usage of http.DefaultClient --- state/remote/atlas.go | 9 ++++++--- state/remote/http_test.go | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/state/remote/atlas.go b/state/remote/atlas.go index f52d834a2..2c2c48895 100644 --- a/state/remote/atlas.go +++ b/state/remote/atlas.go @@ -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) } diff --git a/state/remote/http_test.go b/state/remote/http_test.go index e6e7297c1..74ed1755a 100644 --- a/state/remote/http_test.go +++ b/state/remote/http_test.go @@ -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) }