diff options
author | Martin Polden <mpolden@mpolden.no> | 2022-03-01 10:11:56 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2022-03-01 10:11:56 +0100 |
commit | 5ea6dbc2e4530e217a6f2733ade6b8796894aef6 (patch) | |
tree | c6a4c0614bbef150008b08546a83c79d1a9c1d6a | |
parent | a05cd107528915887e9482638940ac90c0fed94a (diff) |
Remove unused function
-rw-r--r-- | client/go/util/http.go | 10 | ||||
-rw-r--r-- | client/go/util/http_test.go | 8 |
2 files changed, 6 insertions, 12 deletions
diff --git a/client/go/util/http.go b/client/go/util/http.go index f95d52dabad..bb70c3ec6db 100644 --- a/client/go/util/http.go +++ b/client/go/util/http.go @@ -8,7 +8,6 @@ import ( "crypto/tls" "fmt" "net/http" - "net/url" "time" "github.com/vespa-engine/vespa/client/go/build" @@ -45,15 +44,6 @@ func CreateClient(timeout time.Duration) HttpClient { } } -// Convenience function for doing a HTTP GET -func HttpGet(host string, path string, description string) (*http.Response, error) { - url, err := url.Parse(host + path) - if err != nil { - return nil, fmt.Errorf("invalid target url: %s: %w", host+path, err) - } - return HttpDo(&http.Request{URL: url}, time.Second*10, description) -} - func HttpDo(request *http.Request, timeout time.Duration, description string) (*http.Response, error) { if request.Header == nil { request.Header = make(http.Header) diff --git a/client/go/util/http_test.go b/client/go/util/http_test.go index e87a1e5ada4..ccb809d198b 100644 --- a/client/go/util/http_test.go +++ b/client/go/util/http_test.go @@ -41,11 +41,15 @@ func (c mockHttpClient) UseCertificate(certificates []tls.Certificate) {} func TestHttpRequest(t *testing.T) { ActiveHttpClient = mockHttpClient{} - response, err := HttpGet("http://host", "/okpath", "description") + req, err := http.NewRequest("GET", "http://host/okpath", nil) + assert.Nil(t, err) + response, err := HttpDo(req, time.Second*10, "description") assert.Nil(t, err) assert.Equal(t, 200, response.StatusCode) - response, err = HttpGet("http://host", "/otherpath", "description") + req, err = http.NewRequest("GET", "http://host/otherpath", nil) + assert.Nil(t, err) + response, err = HttpDo(req, time.Second*10, "description") assert.Nil(t, err) assert.Equal(t, 500, response.StatusCode) } |