Closed
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
1.10.3
Does this issue reproduce with the latest release?
Yes.
What did you do?
Compare the ResponseRecorder.Result
documentation/comment...
// The Response.Body is guaranteed to be non-nil and Body.Read call is
// guaranteed to not return any error other than io.EOF.
...to actual behaviour:
if rw.Body != nil {
res.Body = ioutil.NopCloser(bytes.NewReader(rw.Body.Bytes()))
}
...and then no case for when rw.Body _is_ nil...
It seems that guarantee doesn't apply if Response.Body
was nil to begin with.