net/http/httptest: close res.Body in test

Signed-off-by: guoguangwu <guoguangwug@gmail.com>
This commit is contained in:
guoguangwu 2024-03-12 16:24:49 +08:00
parent 2ab9218c86
commit d19724c16d
1 changed files with 1 additions and 0 deletions

View File

@ -83,6 +83,7 @@ func testGetAfterClose(t *testing.T, newServer newServerFunc) {
t.Fatal(err)
}
got, err := io.ReadAll(res.Body)
res.Body.Close()
if err != nil {
t.Fatal(err)
}