Skip to content

Commit 6a43c30

Browse files
author
Antoine Huret
committed
add body in error while doing request
1 parent 950968e commit 6a43c30

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

rest/client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package rest
22

33
import (
44
"encoding/json"
5-
"errors"
65
"fmt"
76
"io/ioutil"
87
"net/http"
@@ -60,7 +59,7 @@ func (c *Client) doRequest(request *http.Request, response interface{}) (headers
6059
return
6160
}
6261
if r.StatusCode < 200 || r.StatusCode >= 400 {
63-
err = errors.New("Request error: " + r.Status)
62+
err = fmt.Errorf("Request error (%s): %s", r.Status, string(bodyBytes))
6463
return
6564
}
6665
if r.StatusCode >= 200 && r.StatusCode < 300 {

0 commit comments

Comments
 (0)