fix: timeout handler not implementing http.Flusher (#3225)

This commit is contained in:
Kevin Wan
2023-05-08 18:07:02 +08:00
committed by GitHub
parent 8762a3b7ba
commit 9f42eda9ff
2 changed files with 24 additions and 0 deletions

View File

@@ -127,6 +127,12 @@ type timeoutWriter struct {
var _ http.Pusher = (*timeoutWriter)(nil)
func (tw *timeoutWriter) Flush() {
if flusher, ok := tw.w.(http.Flusher); ok {
flusher.Flush()
}
}
func (tw *timeoutWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
if hijacked, ok := tw.w.(http.Hijacker); ok {
return hijacked.Hijack()