Skip to content

Commit

Permalink
protect against consumers of Assert draining response body
Browse files Browse the repository at this point in the history
  • Loading branch information
Stein Fletcher committed Apr 19, 2019
1 parent 40876e9 commit 83f5a25
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apitest.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,8 @@ func (a *APITest) run() {
func (a *APITest) assertFunc(res *httptest.ResponseRecorder, req *http.Request) error {
if len(a.response.assert) > 0 {
for _, assertFn := range a.response.assert {
err := assertFn(res.Result(), req)
response := res.Result()
err := assertFn(copyHttpResponse(response), req)
if err != nil {
return err
}
Expand Down

0 comments on commit 83f5a25

Please sign in to comment.