gin icon indicating copy to clipboard operation
gin copied to clipboard

github.com/gin-contrib/gzip affects SSE not working

Open fanybook opened this issue 8 months ago • 1 comments

golang version: 1.20.3 github.com/gin-gonic/gin version: v1.9.1 github.com/gin-contrib/gzip version: v1.0.0

package main

import (
	"github.com/gin-contrib/gzip"
	"github.com/gin-gonic/gin"
	"io"
	"time"
)

func main() {
	r := gin.Default()
	r.Use(gzip.Gzip(gzip.DefaultCompression))
	r.GET("/stream", func(c *gin.Context) {
		c.Stream(func(w io.Writer) bool {
			c.SSEvent("chat", time.Now().Format(time.RFC3339))
			time.Sleep(1 * time.Second)
			return true
		})
	})
	r.Run(":9090")
}

fanybook avatar Apr 12 '25 13:04 fanybook

I see the PR are fixed and merged, can we close this issue?

ayushdoesdev avatar Nov 26 '25 14:11 ayushdoesdev