Skip to content

Commit 5a94e62

Browse files
committed
client: preserve query parameters in URL
1 parent 1c1697e commit 5a94e62

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

client.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net"
99
"net/http"
1010
"net/url"
11+
"strings"
1112
)
1213

1314
const (
@@ -111,11 +112,11 @@ func (c *Client) Request(method, URL string, data any, dest any) error {
111112
}
112113
}
113114

114-
u, err := url.Parse(c.apiEndPoint)
115+
// We use this instead of url.JoinPath because the latter removes possible query parameters
116+
u, err := url.Parse(strings.TrimSuffix(c.apiEndPoint, "/") + "/" + strings.TrimPrefix(URL, "/"))
115117
if err != nil {
116118
return err
117119
}
118-
u = u.JoinPath(URL)
119120
if c.apiToken != "" && c.paramToken != "" {
120121
v, err := url.ParseQuery(u.RawQuery)
121122
if err != nil {

0 commit comments

Comments
 (0)