mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 13:22:09 +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"
|
// indicates "Is client disconnected in middle of stream"
|
||||||
func (c *Context) Stream(step func(w io.Writer) bool) bool {
|
func (c *Context) Stream(step func(w io.Writer) bool) bool {
|
||||||
w := c.Writer
|
w := c.Writer
|
||||||
|
if _, ok := w.(http.CloseNotifier); !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
clientGone := w.CloseNotify()
|
clientGone := w.CloseNotify()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
@ -1082,7 +1085,9 @@ func (c *Context) Stream(step func(w io.Writer) bool) bool {
|
|||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
keepOpen := step(w)
|
keepOpen := step(w)
|
||||||
w.Flush()
|
if flusher, ok := w.(http.Flusher); ok {
|
||||||
|
flusher.Flush()
|
||||||
|
}
|
||||||
if !keepOpen {
|
if !keepOpen {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user