From b7a4cf9ec51091bb564e7d758771b967bc411813 Mon Sep 17 00:00:00 2001 From: Jay Wren Date: Sat, 25 Feb 2023 11:50:08 -0500 Subject: [PATCH] remove Content-Type requirement * https://github.com/golang/go/issues/31753 is fixed --- http.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/http.go b/http.go index 1e98196..b5b8904 100644 --- a/http.go +++ b/http.go @@ -11,15 +11,7 @@ import ( // the Accept-Encoding header, sets the Content-Encoding header, and returns a // WriteCloser that implements that compression. The Close method must be called // before the current HTTP handler returns. -// -// Due to https://github.com/golang/go/issues/31753, the response will not be -// compressed unless you set a Content-Type header before you call -// HTTPCompressor. func HTTPCompressor(w http.ResponseWriter, r *http.Request) io.WriteCloser { - if w.Header().Get("Content-Type") == "" { - return nopCloser{w} - } - if w.Header().Get("Vary") == "" { w.Header().Set("Vary", "Accept-Encoding") }