Skip to content

Commit

Permalink
add body in error while doing request
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuret committed Dec 29, 2022
1 parent 950968e commit 6a43c30
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions rest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package rest

import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -60,7 +59,7 @@ func (c *Client) doRequest(request *http.Request, response interface{}) (headers
return
}
if r.StatusCode < 200 || r.StatusCode >= 400 {
err = errors.New("Request error: " + r.Status)
err = fmt.Errorf("Request error (%s): %s", r.Status, string(bodyBytes))
return
}
if r.StatusCode >= 200 && r.StatusCode < 300 {
Expand Down

0 comments on commit 6a43c30

Please sign in to comment.