From 9b958188bcdd49aaf3b7276e45ddda184e382f63 Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Fri, 15 Jan 2021 06:08:58 +0000 Subject: [PATCH] bug: fix an issue where query parameters weren't being added to the request --- coder-sdk/request.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/coder-sdk/request.go b/coder-sdk/request.go index c9f82ffa..d256aff2 100644 --- a/coder-sdk/request.go +++ b/coder-sdk/request.go @@ -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 @@ -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) }