Skip to content

Commit

Permalink
test: body read
Browse files Browse the repository at this point in the history
  • Loading branch information
brokeyourbike committed Aug 30, 2023
1 parent 26cdec2 commit 8f036b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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!"))
Expand Down

0 comments on commit 8f036b3

Please sign in to comment.