Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed Feb 28, 2024
1 parent 7a55a9c commit ff36da4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/apiclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/apiclient/client_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit ff36da4

Please sign in to comment.