]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: close res.Body
authorguoguangwu <guoguangwug@gmail.com>
Fri, 8 Mar 2024 02:25:30 +0000 (02:25 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 8 Mar 2024 19:01:29 +0000 (19:01 +0000)
Change-Id: I0f9faf2a946ebebf9ae30f065f20ec6028c65c22
GitHub-Last-Rev: d957ce10202896f2da4262340cd73fb4faa75836
GitHub-Pull-Request: golang/go#66181
Reviewed-on: https://go-review.googlesource.com/c/go/+/569976
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
src/net/http/response_test.go

index f3425c3c2046aca5ceeb8b949b0cfb97eb509cbf..a63aac95ac1f691961f6f80e2666f708a02d965a 100644 (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)
        }