From ff36da47753febc51bf777f8e2564507882bab2a Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 28 Feb 2024 10:07:57 +0100 Subject: [PATCH] wip --- pkg/apiclient/client.go | 3 +++ pkg/apiclient/client_http.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/apiclient/client.go b/pkg/apiclient/client.go index 7add3157ffdc..1a1b75f3f71b 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 78bcece556c6..0240618f5356 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) }