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

bug: fix an issue where query parameters weren't being added to the r… #219

Merged
merged 1 commit into from
Jan 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion coder-sdk/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ func (c Client) request(ctx context.Context, method, path string, in interface{}
if config.BaseURLOverride != nil {
url = *config.BaseURLOverride
}
if config.Query != nil {
url.RawQuery = config.Query.Encode()
}

url.Path = path

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

// Create the http request.
req, err := http.NewRequestWithContext(ctx, method, url.String()+path, payload)
req, err := http.NewRequestWithContext(ctx, method, url.String(), payload)
if err != nil {
return nil, xerrors.Errorf("create request: %w", err)
}
Expand Down