diff --git a/client/http.go b/client/http.go index aa2a65078..306e5c45d 100644 --- a/client/http.go +++ b/client/http.go @@ -53,21 +53,6 @@ type httpClient struct { timeout time.Duration } -func newHTTPClient(tr *http.Transport, ep string, to time.Duration) (*httpClient, error) { - u, err := url.Parse(ep) - if err != nil { - return nil, err - } - - c := &httpClient{ - transport: tr, - endpoint: *u, - timeout: to, - } - - return c, nil -} - func (c *httpClient) doWithTimeout(act httpAction) (*http.Response, []byte, error) { ctx, cancel := context.WithTimeout(context.Background(), c.timeout) defer cancel() diff --git a/client/keys.go b/client/keys.go index 1bbc7cb10..c0207d1bd 100644 --- a/client/keys.go +++ b/client/keys.go @@ -50,11 +50,19 @@ func NewDiscoveryKeysAPI(tr *http.Transport, ep string, to time.Duration) (KeysA } func newHTTPKeysAPIWithPrefix(tr *http.Transport, ep string, to time.Duration, prefix string) (*HTTPKeysAPI, error) { - c, err := newHTTPClient(tr, ep, to) + u, err := url.Parse(ep) if err != nil { return nil, err } + u.Path = path.Join(u.Path, prefix) + + c := &httpClient{ + transport: tr, + endpoint: *u, + timeout: to, + } + kAPI := HTTPKeysAPI{ client: c, }