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

Commit e52bd24

Browse files
authored
bug: fix an issue where query parameters weren't being added to the request (#219)
1 parent b04eb60 commit e52bd24

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

coder-sdk/request.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ func (c Client) request(ctx context.Context, method, path string, in interface{}
2727
if config.BaseURLOverride != nil {
2828
url = *config.BaseURLOverride
2929
}
30+
if config.Query != nil {
31+
url.RawQuery = config.Query.Encode()
32+
}
33+
34+
url.Path = path
3035

3136
// If we have incoming data, encode it as json.
3237
var payload io.Reader
@@ -39,7 +44,7 @@ func (c Client) request(ctx context.Context, method, path string, in interface{}
3944
}
4045

4146
// Create the http request.
42-
req, err := http.NewRequestWithContext(ctx, method, url.String()+path, payload)
47+
req, err := http.NewRequestWithContext(ctx, method, url.String(), payload)
4348
if err != nil {
4449
return nil, xerrors.Errorf("create request: %w", err)
4550
}

0 commit comments

Comments
 (0)