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:
Ayush Sawant
2024-10-22 02:19:34 +05:30
committed by GitHub
parent 9fe2c6ce1f
commit fb15ff9dcd
3 changed files with 24 additions and 19 deletions

View File

@@ -104,7 +104,10 @@ func (e *APIError) UnmarshalJSON(data []byte) (err error) {
}
func (e *RequestError) Error() string {
return fmt.Sprintf("error, status code: %d, status: %s, message: %s", e.HTTPStatusCode, e.HTTPStatus, e.Err)
return fmt.Sprintf(
"error, status code: %d, status: %s, message: %s, body: %s",
e.HTTPStatusCode, e.HTTPStatus, e.Err, e.Body,
)
}
func (e *RequestError) Unwrap() error {