diff --git a/client.go b/client.go index 1acf830..433abd5 100644 --- a/client.go +++ b/client.go @@ -62,7 +62,7 @@ type Client struct { } func fixAddress(address string) string { - if !strings.HasPrefix(address, "http") { + if !strings.HasPrefix(address, "http://") && !strings.HasPrefix(address, "https://") { address = "https://" + address } return address + "/api/v2/" diff --git a/client_test.go b/client_test.go index 9900ddd..6d1a3e5 100644 --- a/client_test.go +++ b/client_test.go @@ -299,6 +299,18 @@ func TestHttpConnection(t *testing.T) { assert.Equal("http://localhost:8080/api/v2/", client.BaseURL.String()) } +func TestHttpInDomain(t *testing.T) { + assert := asserts.New(t) + config := &Config{ + Address: "httpserver.com", + Token: "987654321", + SkipTLSVerify: true, + } + client, err := NewClient(config) + assert.NoError(err) + assert.Equal("https://httpserver.com/api/v2/", client.BaseURL.String()) +} + func TestDoRest_DirectResponse(t *testing.T) { responseStr := ` { diff --git a/version b/version index 850e742..a4cc557 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.14.0 +1.14.2