Skip to content

Commit df74f62

Browse files
committed
Fix test
1 parent eb7f29b commit df74f62

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/testutil/mock.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ func MockRequestBodyValidateNoBody(t *testing.T, response any) httpmock.Responde
6161

6262
return func(request *http.Request) (*http.Response, error) {
6363
if request.Body != nil {
64-
t.Fatal("got request body when no request body was expected")
64+
body, e := io.ReadAll(request.Body)
65+
if e != nil {
66+
t.Fatal(e)
67+
}
68+
if len(body) > 0 {
69+
t.Fatalf("got non-empty request body when no request body was expected: '%v'", string(body))
70+
}
6571
}
6672

6773
return httpmock.NewJsonResponse(http.StatusOK, response)

0 commit comments

Comments
 (0)