From 6ee3349ccad47632546af8350f988e35beae4fca Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Sat, 7 May 2022 19:42:36 -0400 Subject: [PATCH] Fix randomly failing test --- util/content_type_writer_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/content_type_writer_test.go b/util/content_type_writer_test.go index 0fdf65cc..e30e821b 100644 --- a/util/content_type_writer_test.go +++ b/util/content_type_writer_test.go @@ -44,7 +44,7 @@ func TestSniffWriter_WriteUnknownMimeType(t *testing.T) { rr := httptest.NewRecorder() sw := NewContentTypeWriter(rr, "") randomBytes := make([]byte, 199) - rand.Read(randomBytes) + rand.Read(randomBytes[5:]) // Start at an offset; the test kept failing randomly because it hit random magic strings sw.Write(randomBytes) require.Equal(t, "application/octet-stream", rr.Header().Get("Content-Type")) }