Handling for non-json response (#881)
* removed handling for non-json response * added response body in RequestError.Error() and updated tests * done linting
This commit is contained in:
@@ -289,9 +289,6 @@ func (c *Client) handleErrorResp(resp *http.Response) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("error, reading response body: %w", err)
|
||||
}
|
||||
if !strings.HasPrefix(resp.Header.Get("Content-Type"), "application/json") {
|
||||
return fmt.Errorf("error, status code: %d, status: %s, body: %s", resp.StatusCode, resp.Status, body)
|
||||
}
|
||||
var errRes ErrorResponse
|
||||
err = json.Unmarshal(body, &errRes)
|
||||
if err != nil || errRes.Error == nil {
|
||||
|
||||
Reference in New Issue
Block a user