From d34904d9d17c4459ba8881db3183b38f7ab2c8c1 Mon Sep 17 00:00:00 2001 From: nickbug Date: Mon, 13 Dec 2021 07:05:11 +0800 Subject: [PATCH] Fix don't gzip server-sent events (#31) --- handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler.go b/handler.go index 643a812..a942c2a 100644 --- a/handler.go +++ b/handler.go @@ -63,7 +63,7 @@ func (g *gzipHandler) Handle(c *gin.Context) { func (g *gzipHandler) shouldCompress(req *http.Request) bool { if !strings.Contains(req.Header.Get("Accept-Encoding"), "gzip") || strings.Contains(req.Header.Get("Connection"), "Upgrade") || - strings.Contains(req.Header.Get("Content-Type"), "text/event-stream") { + strings.Contains(req.Header.Get("Accept"), "text/event-stream") { return false }