net/http: close res.Body

Signed-off-by: guoguangwu <guoguangwug@gmail.com>
This commit is contained in:
guoguangwu 2024-03-08 10:19:25 +08:00
parent 69583738eb
commit d957ce1020
1 changed files with 1 additions and 0 deletions

View File

@ -826,6 +826,7 @@ func TestResponseContentLengthShortBody(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer res.Body.Close()
if res.ContentLength != 123 {
t.Fatalf("Content-Length = %d; want 123", res.ContentLength)
}