Plugins: Require body is closed on test cleanup (#62668)

require body is closed on cleanup
This commit is contained in:
Will Browne
2023-02-01 15:28:25 +01:00
committed by GitHub
parent c139768e3b
commit 2f2046eff7

View File

@ -139,8 +139,7 @@ func makePostRequest(t *testing.T, URL string) (int, map[string]interface{}) {
resp, err := http.Post(URL, "application/json", bytes.NewBufferString(""))
require.NoError(t, err)
t.Cleanup(func() {
_ = resp.Body.Close()
fmt.Printf("Failed to close response body err: %s", err)
require.NoError(t, resp.Body.Close())
})
b, err := io.ReadAll(resp.Body)
require.NoError(t, err)