Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit b823a18

Browse files
committed
bug: fix an issue where query parameters weren't being added to the request
1 parent b04eb60 commit b823a18

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

coder-sdk/request.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ func (c Client) request(ctx context.Context, method, path string, in interface{}
2828
url = *config.BaseURLOverride
2929
}
3030

31+
url.Path = path
32+
33+
if config.Query != nil {
34+
url.RawQuery = config.Query.Encode()
35+
}
36+
3137
// If we have incoming data, encode it as json.
3238
var payload io.Reader
3339
if in != nil {
@@ -39,7 +45,7 @@ func (c Client) request(ctx context.Context, method, path string, in interface{}
3945
}
4046

4147
// Create the http request.
42-
req, err := http.NewRequestWithContext(ctx, method, url.String()+path, payload)
48+
req, err := http.NewRequestWithContext(ctx, method, url.String(), payload)
4349
if err != nil {
4450
return nil, xerrors.Errorf("create request: %w", err)
4551
}

0 commit comments

Comments
 (0)