Commit 2889332e authored by LE Manh Cuong's avatar LE Manh Cuong Committed by Brad Fitzpatrick

net/http: make TimeoutHandler's ResponseWriter implement Pusher

Fixes #29193

Change-Id: I03088205e51036abbc861ab5b7d141327b0429ae
Reviewed-on: https://go-review.googlesource.com/c/154383Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 342764a2
......@@ -3223,6 +3223,25 @@ type timeoutWriter struct {
code int
}
var _ Pusher = (*timeoutWriter)(nil)
var _ Flusher = (*timeoutWriter)(nil)
// Push implements the Pusher interface.
func (tw *timeoutWriter) Push(target string, opts *PushOptions) error {
if pusher, ok := tw.w.(Pusher); ok {
return pusher.Push(target, opts)
}
return ErrNotSupported
}
// Flush implements the Flusher interface.
func (tw *timeoutWriter) Flush() {
f, ok := tw.w.(Flusher)
if ok {
f.Flush()
}
}
func (tw *timeoutWriter) Header() Header { return tw.h }
func (tw *timeoutWriter) Write(p []byte) (int, error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment