diff --git a/rest/client.go b/rest/client.go index 6e6346e..3861ab7 100644 --- a/rest/client.go +++ b/rest/client.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "net/http" "net/url" + "strings" "github.com/pkg/errors" @@ -83,6 +84,12 @@ func withLogin() ClientOption { } func (c *RESTClient) Do(httpMethod, urlPath string, req, v interface{}) error { + if !strings.HasPrefix(c.endpoint, "http") { + c.endpoint = "http://" + c.endpoint + } + if !strings.HasSuffix(c.endpoint, "/api2/json") { + c.endpoint += "/api2/json" + } url, err := url.JoinPath(c.endpoint, urlPath) if err != nil { return err