mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 05:16:35 +08:00
fix: golanglint
This commit is contained in:
parent
fe989b6a6f
commit
72838a5d2e
@ -1075,6 +1075,9 @@ 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
|
||||
if _, ok := w.(http.CloseNotifier); !ok {
|
||||
return false
|
||||
}
|
||||
clientGone := w.CloseNotify()
|
||||
for {
|
||||
select {
|
||||
@ -1082,7 +1085,9 @@ func (c *Context) Stream(step func(w io.Writer) bool) bool {
|
||||
return true
|
||||
default:
|
||||
keepOpen := step(w)
|
||||
w.Flush()
|
||||
if flusher, ok := w.(http.Flusher); ok {
|
||||
flusher.Flush()
|
||||
}
|
||||
if !keepOpen {
|
||||
return false
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user