diff --git a/response_writer.go b/response_writer.go index 232f00aa..a45690af 100644 --- a/response_writer.go +++ b/response_writer.go @@ -37,6 +37,9 @@ type ResponseWriter interface { // Forces to write the http header (status code + headers). WriteHeaderNow() + + // get the http.Pusher for server push + Pusher() } type responseWriter struct { @@ -112,3 +115,10 @@ func (w *responseWriter) CloseNotify() <-chan bool { func (w *responseWriter) Flush() { w.ResponseWriter.(http.Flusher).Flush() } + +func (w *responseWriter) Pusher() (pusher http.Pusher) { + if pusher, ok := w.ResponseWriter.(http.ResponseWriter).(http.Pusher); ok { + return pusher + } + return nil +}