From 8f036b32655eb439486b868adbda1c88a5c7f231 Mon Sep 17 00:00:00 2001 From: Ivan Stasiuk Date: Wed, 30 Aug 2023 12:39:04 +0100 Subject: [PATCH] test: body read --- test_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test_test.go b/test_test.go index 52d96ef..8f6e4bc 100644 --- a/test_test.go +++ b/test_test.go @@ -64,7 +64,10 @@ func TestFailedHttpRequestBodyDecode(t *testing.T) { client := clearbank.NewClient("token", local.NewNilSigner(), clearbank.WithHTTPClient(mockHttpClient)) body := io.NopCloser(bytes.NewReader(nil)) - require.NoError(t, body.Close()) + + _, err := io.ReadAll(body) + require.NoError(t, err) + mockHttpClient.On("Do", mock.AnythingOfType("*http.Request")).Return(&http.Response{Body: body}, nil).Once() assert.Error(t, client.Test(context.TODO(), "hello!"))