Set the request.Body to http.NoBody if request.Body is nil #105
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that on certain requests I get a missing interaction error. But looking at the yaml file the interaction is there.
I tracked it down to certain Post requests that do no have any body. So when the replay matches the body is nil, and r.ParseForm returns an error when it shouldn't.
https://github.com/dnaeon/go-vcr/blob/e544a7e468e5bd51652002be6cfd6ee604f945b0/pkg/cassette/cassette.go#L345C1-L352C1
and the error is raised
https://cs.opensource.google/go/go/+/refs/tags/go1.23.2:src/net/http/request.go;l=1272-1276;drc=29b1a6765fb5f124171d94f157b6d6c3b2687468
An example of what causes the error to occur.
https://github.com/ilijamt/vault-plugin-secrets-gitlab/blob/33f02606e7871715fb682d08b8a7232e40720eab/testdata/fixtures/16.11.6/TestWithServiceAccountUser.yaml