fix(utils): close resp in test to satisfy bodyclose linter

This commit is contained in:
ItsT0ng 2026-03-01 16:53:44 +11:00
parent e8c6d82fdb
commit 2ab6704e59

View file

@ -107,6 +107,9 @@ func TestDoRequestWithRetry_ContextCancel(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
resp, err := DoRequestWithRetry(client, req) resp, err := DoRequestWithRetry(client, req)
if resp != nil {
resp.Body.Close()
}
require.Error(t, err, "expected error from context cancellation") require.Error(t, err, "expected error from context cancellation")
assert.Nil(t, resp, "expected nil response when context is canceled") assert.Nil(t, resp, "expected nil response when context is canceled")
assert.True(t, bodyClosed, "expected resp.Body to be closed on context cancellation") assert.True(t, bodyClosed, "expected resp.Body to be closed on context cancellation")