From 7525086d6183fc19535e646922e54ff6e2878b04 Mon Sep 17 00:00:00 2001 From: Tiger Xu / Zhonghu Xu Date: Sat, 26 Jul 2025 18:15:47 +0800 Subject: [PATCH] Fix Stream() to use http.Request.Context I found this when doing test with httptest, it doesnot support CloseNotify at all. --- context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context.go b/context.go index 842ad2ff..7d2df67c 100644 --- a/context.go +++ b/context.go @@ -1242,7 +1242,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: