Skip to content

Commit

Permalink
promclient: fix error's message (#3824)
Browse files Browse the repository at this point in the history
Use the provided `method` in the error messages. I got scared reading
the logs that the requests are still being sent using GET instead of
POST which I had specified.

Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>
  • Loading branch information
GiedriusS committed Feb 23, 2021
1 parent 1bc66f9 commit fed3c9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/promclient/promclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (c *Client) req2xx(ctx context.Context, u *url.URL, method string) (_ []byt

req, err := http.NewRequest(method, u.String(), b)
if err != nil {
return nil, 0, errors.Wrap(err, "create GET request")
return nil, 0, errors.Wrapf(err, "create %s request", method)
}
if c.userAgent != "" {
req.Header.Set("User-Agent", c.userAgent)
Expand All @@ -121,7 +121,7 @@ func (c *Client) req2xx(ctx context.Context, u *url.URL, method string) (_ []byt

resp, err := c.Do(req.WithContext(ctx))
if err != nil {
return nil, 0, errors.Wrapf(err, "perform GET request against %s", u.String())
return nil, 0, errors.Wrapf(err, "perform %s request against %s", method, u.String())
}
defer runutil.ExhaustCloseWithErrCapture(&err, resp.Body, "%s: close body", req.URL.String())

Expand Down

0 comments on commit fed3c9e

Please sign in to comment.