Skip to content

Commit e0eabf6

Browse files
ilijamtdnaeon
authored andcommitted
Set the request.Body to http.NoBody if request.Body is nil
1 parent e544a7e commit e0eabf6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/cassette/cassette.go

+5
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,11 @@ func (c *Cassette) GetInteraction(r *http.Request) (*Interaction, error) {
459459
func (c *Cassette) getInteraction(r *http.Request) (*Interaction, error) {
460460
c.Lock()
461461
defer c.Unlock()
462+
if r.Body == nil {
463+
// causes an error in the matcher when we try to do r.ParseForm if r.Body is nil
464+
// r.ParseForm returns missing form body error
465+
r.Body = http.NoBody
466+
}
462467
for _, i := range c.Interactions {
463468
if (c.ReplayableInteractions || !i.replayed) && c.Matcher(r, i.Request) {
464469
i.replayed = true

0 commit comments

Comments
 (0)