aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/httputil/reverseproxy_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/http/httputil/reverseproxy_test.go')
-rw-r--r--src/net/http/httputil/reverseproxy_test.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/net/http/httputil/reverseproxy_test.go b/src/net/http/httputil/reverseproxy_test.go
index 67d0e50593..2f9a5eec5c 100644
--- a/src/net/http/httputil/reverseproxy_test.go
+++ b/src/net/http/httputil/reverseproxy_test.go
@@ -137,6 +137,7 @@ func TestReverseProxy(t *testing.T) {
if g, e := res.Trailer.Get("X-Unannounced-Trailer"), "unannounced_trailer_value"; g != e {
t.Errorf("Trailer(X-Unannounced-Trailer) = %q ; want %q", g, e)
}
+ res.Body.Close()
// Test that a backend failing to be reached or one which doesn't return
// a response results in a StatusBadGateway.
@@ -328,6 +329,7 @@ func TestXForwardedFor(t *testing.T) {
if err != nil {
t.Fatalf("Get: %v", err)
}
+ defer res.Body.Close()
if g, e := res.StatusCode, backendStatus; g != e {
t.Errorf("got res.StatusCode %d; expected %d", g, e)
}
@@ -801,6 +803,7 @@ func TestReverseProxy_Post(t *testing.T) {
if err != nil {
t.Fatalf("Do: %v", err)
}
+ defer res.Body.Close()
if g, e := res.StatusCode, backendStatus; g != e {
t.Errorf("got res.StatusCode %d; expected %d", g, e)
}
@@ -1571,7 +1574,7 @@ func TestUnannouncedTrailer(t *testing.T) {
}
io.ReadAll(res.Body)
-
+ res.Body.Close()
if g, w := res.Trailer.Get("X-Unannounced-Trailer"), "unannounced_trailer_value"; g != w {
t.Errorf("Trailer(X-Unannounced-Trailer) = %q; want %q", g, w)
}