Commit 0a7ca64f authored by Matt Holt's avatar Matt Holt

gzipResponseWriter should also be a Flusher

To be consistent with 3faad41b and c64cf218
parent c4e2cf96
...@@ -142,6 +142,16 @@ func (w *gzipResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { ...@@ -142,6 +142,16 @@ func (w *gzipResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return nil, nil, fmt.Errorf("not a Hijacker") return nil, nil, fmt.Errorf("not a Hijacker")
} }
// Flush implements http.Flusher. It simply wraps the underlying
// ResponseWriter's Flush method if there is one, or panics.
func (w *gzipResponseWriter) Flush() {
if f, ok := w.ResponseWriter.(http.Flusher); ok {
f.Flush()
} else {
panic("not a Flusher") // should be recovered at the beginning of middleware stack
}
}
// CloseNotify implements http.CloseNotifier. // CloseNotify implements http.CloseNotifier.
// It just inherits the underlying ResponseWriter's CloseNotify method. // It just inherits the underlying ResponseWriter's CloseNotify method.
func (w *gzipResponseWriter) CloseNotify() <-chan bool { func (w *gzipResponseWriter) CloseNotify() <-chan bool {
......
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