Skip to content

Commit

Permalink
Correctly check errors when building requests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcorbin committed Jan 6, 2024
1 parent 330555f commit d8f0a1e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ func (c *Client) sendRequest(ctx context.Context, url string, method string, bod
method,
fmt.Sprintf("%s%s", c.endpoint, url),
reqBody)
if err != nil {
return nil, err
}
if len(queryParams) != 0 {
q := request.URL.Query()
for k, v := range queryParams {
Expand All @@ -194,9 +197,6 @@ func (c *Client) sendRequest(ctx context.Context, url string, method string, bod
creds := base64.StdEncoding.EncodeToString([]byte(authString))
request.Header.Add("Authorization", fmt.Sprintf("Basic %s", creds))
}
if err != nil {
return nil, err
}
response, err := c.http.Do(request)
if err != nil {
return nil, err
Expand Down

0 comments on commit d8f0a1e

Please sign in to comment.