chore(response): prevent Flush() panic when http.Flusher (#4479)

This commit is contained in:
Twacqwq 2025-12-24 18:35:20 +08:00 committed by GitHub
parent 22c274c84b
commit 26c3a62865
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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) {