Skip to content

Commit

Permalink
still return body when Response.ToBytes() got an error
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Oct 11, 2022
1 parent 6139df8 commit 333d103
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,9 @@ func (r *Response) ToBytes() ([]byte, error) {
}
defer r.Body.Close()
body, err := ioutil.ReadAll(r.Body)
r.setReceivedAt()
if err != nil {
return nil, err
}
r.body = body
return body, nil
r.setReceivedAt()
return body, err
}

// Dump return the string content that have been dumped for the request.
Expand Down

0 comments on commit 333d103

Please sign in to comment.