From 3f5e827e3ccdd027174f952c45bd44f8fe15f798 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Mon, 26 Jan 2015 17:08:43 -0800 Subject: [PATCH] client: httpClient -> simpleHTTPClient --- client/http.go | 6 +++--- client/http_test.go | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/client/http.go b/client/http.go index e760b6b23..987cbfce8 100644 --- a/client/http.go +++ b/client/http.go @@ -39,7 +39,7 @@ var ( func defaultHTTPClientFactory(tr CancelableTransport, ep url.URL) HTTPClient { return &redirectFollowingHTTPClient{ max: DefaultMaxRedirects, - client: &httpClient{ + client: &simpleHTTPClient{ transport: tr, endpoint: ep, }, @@ -181,12 +181,12 @@ type roundTripResponse struct { err error } -type httpClient struct { +type simpleHTTPClient struct { transport CancelableTransport endpoint url.URL } -func (c *httpClient) Do(ctx context.Context, act HTTPAction) (*http.Response, []byte, error) { +func (c *simpleHTTPClient) Do(ctx context.Context, act HTTPAction) (*http.Response, []byte, error) { req := act.HTTPRequest(c.endpoint) rtchan := make(chan roundTripResponse, 1) diff --git a/client/http_test.go b/client/http_test.go index 45c27cdbc..19dd8e89c 100644 --- a/client/http_test.go +++ b/client/http_test.go @@ -109,9 +109,9 @@ func (a *fakeAction) HTTPRequest(url.URL) *http.Request { return &http.Request{} } -func TestHTTPClientDoSuccess(t *testing.T) { +func TestSimpleHTTPClientDoSuccess(t *testing.T) { tr := newFakeTransport() - c := &httpClient{transport: tr} + c := &simpleHTTPClient{transport: tr} tr.respchan <- &http.Response{ StatusCode: http.StatusTeapot, @@ -134,9 +134,9 @@ func TestHTTPClientDoSuccess(t *testing.T) { } } -func TestHTTPClientDoError(t *testing.T) { +func TestSimpleHTTPClientDoError(t *testing.T) { tr := newFakeTransport() - c := &httpClient{transport: tr} + c := &simpleHTTPClient{transport: tr} tr.errchan <- errors.New("fixture") @@ -146,9 +146,9 @@ func TestHTTPClientDoError(t *testing.T) { } } -func TestHTTPClientDoCancelContext(t *testing.T) { +func TestSimpleHTTPClientDoCancelContext(t *testing.T) { tr := newFakeTransport() - c := &httpClient{transport: tr} + c := &simpleHTTPClient{transport: tr} tr.startCancel <- struct{}{} tr.finishCancel <- struct{}{} @@ -159,9 +159,9 @@ func TestHTTPClientDoCancelContext(t *testing.T) { } } -func TestHTTPClientDoCancelContextWaitForRoundTrip(t *testing.T) { +func TestSimpleHTTPClientDoCancelContextWaitForRoundTrip(t *testing.T) { tr := newFakeTransport() - c := &httpClient{transport: tr} + c := &simpleHTTPClient{transport: tr} donechan := make(chan struct{}) ctx, cancel := context.WithCancel(context.Background()) @@ -175,7 +175,7 @@ func TestHTTPClientDoCancelContextWaitForRoundTrip(t *testing.T) { select { case <-donechan: - t.Fatalf("httpClient.do should not have exited yet") + t.Fatalf("simpleHTTPClient.Do should not have exited yet") default: } @@ -186,7 +186,7 @@ func TestHTTPClientDoCancelContextWaitForRoundTrip(t *testing.T) { //expected behavior return case <-time.After(time.Second): - t.Fatalf("httpClient.do did not exit within 1s") + t.Fatalf("simpleHTTPClient.Do did not exit within 1s") } }