diff --git a/middleware.go b/middleware.go index 3293854b..9b7b33d4 100644 --- a/middleware.go +++ b/middleware.go @@ -334,6 +334,7 @@ func responseLogger(c *Client, res *Response) error { func parseResponseBody(c *Client, res *Response) (err error) { if res.StatusCode() == http.StatusNoContent { + res.Request.Error = nil return } // Handles only JSON or XML content type diff --git a/response.go b/response.go index 55012839..bda7787b 100644 --- a/response.go +++ b/response.go @@ -93,7 +93,7 @@ func (r *Response) Cookies() []*http.Cookie { // String method returns the body of the server response as String. func (r *Response) String() string { - if r.body == nil { + if len(r.body) == 0 { return "" } return strings.TrimSpace(string(r.body)) @@ -156,7 +156,7 @@ func (r *Response) setReceivedAt() { } func (r *Response) fmtBodyString(sl int64) string { - if r.body != nil { + if len(r.body) > 0 { if int64(len(r.body)) > sl { return fmt.Sprintf("***** RESPONSE TOO LARGE (size - %d) *****", len(r.body)) }