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 ff36da4 commit 3211bb3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions pkg/apiclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ 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 Expand Up @@ -186,6 +183,7 @@ func createTransport(url *url.URL) (*http.Transport, *url.URL) {

// Unix transport
url.Path = "/"
// XXX: ?
url.Host = "unix"
url.Scheme = "http"

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, "/") {
if !strings.HasSuffix(c.BaseURL.Path, "/") && c.BaseURL.Host != "unix" {
return nil, fmt.Errorf("BaseURL must have a trailing slash, but %q does not", c.BaseURL)
}

Expand Down

0 comments on commit 3211bb3

Please sign in to comment.