fix(4460): prevent Flush() panic when http.Flusher is not implemented

This commit is contained in:
Twacqwq 2025-12-20 16:20:45 +08:00
parent d1a15347b1
commit a36555ba8f

View File

@ -128,7 +128,9 @@ func (w *responseWriter) CloseNotify() <-chan bool {
// Flush implements the http.Flusher interface.
func (w *responseWriter) Flush() {
w.WriteHeaderNow()
w.ResponseWriter.(http.Flusher).Flush()
if f, ok := w.ResponseWriter.(http.Flusher); ok {
f.Flush()
}
}
func (w *responseWriter) Pusher() (pusher http.Pusher) {