From 21744b96bd9534f0ab1792cd877fcd3b113bb92c Mon Sep 17 00:00:00 2001 From: Mitar Date: Thu, 7 Apr 2022 11:08:39 +0200 Subject: [PATCH] Body should be empty. --- src/net/http/fs_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/net/http/fs_test.go b/src/net/http/fs_test.go index f570eba73c..ae6c968f19 100644 --- a/src/net/http/fs_test.go +++ b/src/net/http/fs_test.go @@ -595,7 +595,14 @@ func testServeFileNotModified(t *testing.T, h2 bool) { if err != nil { t.Fatal(err) } + b, err := io.ReadAll(resp.Body) resp.Body.Close() + if err != nil { + t.Fatal("reading Body:", err) + } + if len(b) != 0 { + t.Errorf("non-empty body") + } if g, e := resp.StatusCode, StatusNotModified; g != e { t.Errorf("status mismatch: got %d, want %d", g, e) }