diff --git a/pkg/apiclient/client.go b/pkg/apiclient/client.go index 7add3157ffd..1a1b75f3f71 100644 --- a/pkg/apiclient/client.go +++ b/pkg/apiclient/client.go @@ -90,6 +90,9 @@ func NewClient(config *Config) (*ApiClient, error) { ht.TLSClientConfig = &tlsconfig } + // convert backslashes to slashes + baseUrl.Path = strings.ReplaceAll(baseUrl.Path, "\\", "/") + c := &ApiClient{client: t.Client(), BaseURL: baseUrl, UserAgent: config.UserAgent, URLPrefix: config.VersionPrefix, PapiURL: config.PapiURL} c.common.client = c c.Decisions = (*DecisionsService)(&c.common) diff --git a/pkg/apiclient/client_http.go b/pkg/apiclient/client_http.go index 78bcece556c..0240618f535 100644 --- a/pkg/apiclient/client_http.go +++ b/pkg/apiclient/client_http.go @@ -16,7 +16,7 @@ import ( ) func (c *ApiClient) NewRequest(method, url string, body interface{}) (*http.Request, error) { - if !strings.HasSuffix(c.BaseURL.Path, "/") && !strings.HasPrefix(c.BaseURL.Path, "/") { + if !strings.HasSuffix(c.BaseURL.Path, "/") { return nil, fmt.Errorf("BaseURL must have a trailing slash, but %q does not", c.BaseURL) }