go-vcr messes with a Body set to http.NoBody
vangent opened this issue · comments
Robert van Gent commented
According to net/http
(https://golang.org/pkg/net/http/):
http.NoBody can be used in an outgoing client request to explicitly signal that a request has zero bytes. An alternative, however, is to simply set Request.Body to nil.
recorder.go checks for r.Body != nil
before inserting a new Reader
(a TeeReader
used to save the Body into a buffer in order to record it). However, if r.Body
is http.NoBody
, it still inserts the new Reader
. This can result in the HTTP request being made without a Content-Length=0
header.
Robert van Gent commented
golang/go#20257 (comment) is relevant.
Robert van Gent commented
Fixed with #39.