From be2c707a4c170063599c3f73d1de55f2652345a2 Mon Sep 17 00:00:00 2001 From: Lukasz Szaszkiewicz Date: Wed, 17 Aug 2022 10:52:12 +0200 Subject: [PATCH] integration: TestCacheControl and TestHSTS close the ResponseBody --- test/integration/apiserver/apiserver_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/integration/apiserver/apiserver_test.go b/test/integration/apiserver/apiserver_test.go index c371ead248f..6c4d8e7fd21 100644 --- a/test/integration/apiserver/apiserver_test.go +++ b/test/integration/apiserver/apiserver_test.go @@ -246,6 +246,7 @@ func TestCacheControl(t *testing.T) { if err != nil { t.Fatal(err) } + defer resp.Body.Close() cc := resp.Header.Get("Cache-Control") if !strings.Contains(cc, "private") { t.Errorf("expected private cache-control, got %q", cc) @@ -291,6 +292,7 @@ func TestHSTS(t *testing.T) { if err != nil { t.Fatal(err) } + defer resp.Body.Close() cc := resp.Header.Get("Strict-Transport-Security") if !strings.Contains(cc, "max-age=31536000; includeSubDomains") { t.Errorf("expected max-age=31536000; includeSubDomains, got %q", cc)