1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00

Wrapped Flush, Hijack and CloseNotify functions in response.

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-05-18 17:23:44 -07:00
parent 5df84923dd
commit cd1e235ccc

View File

@ -1,7 +1,9 @@
package echo
import (
"bufio"
"log"
"net"
"net/http"
"github.com/labstack/gommon/color"
@ -37,6 +39,21 @@ func (r *Response) Write(b []byte) (n int, err error) {
return n, err
}
// Flush wraps response writer's Flush function.
func (r *Response) Flush() {
r.Writer.(http.Flusher).Flush()
}
// Hijack wraps response writer's Hijack function.
func (r *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return r.Writer.(http.Hijacker).Hijack()
}
// CloseNotify wraps response writer's CloseNotify function.
func (r *Response) CloseNotify() <-chan bool {
return r.Writer.(http.CloseNotifier).CloseNotify()
}
func (r *Response) Status() int {
return r.status
}
@ -47,5 +64,6 @@ func (r *Response) Size() int64 {
func (r *Response) reset(w http.ResponseWriter) {
r.Writer = w
r.status = http.StatusOK
r.committed = false
}