fix(context): improve client disconnection handling in Stream method

This commit is contained in:
linhujun 2025-04-15 11:18:39 +08:00
parent 49e9137c68
commit b0e3cdc077

View File

@ -1208,7 +1208,7 @@ func (c *Context) SSEvent(name string, message any) {
// indicates "Is client disconnected in middle of stream"
func (c *Context) Stream(step func(w io.Writer) bool) bool {
w := c.Writer
clientGone := w.CloseNotify()
clientGone := c.Request.Context().Done()
for {
select {
case <-clientGone: