diff --git a/router.go b/router.go index 5047497f..401fddbb 100644 --- a/router.go +++ b/router.go @@ -1,7 +1,10 @@ package beego import ( + "bufio" + "errors" "fmt" + "net" "net/http" "net/url" "os" @@ -864,3 +867,13 @@ func (w *responseWriter) WriteHeader(code int) { w.started = true w.writer.WriteHeader(code) } + +// hijacker for http +func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { + hj, ok := w.writer.(http.Hijacker) + if !ok { + println("supported?") + return nil, nil, errors.New("webserver doesn't support hijacking") + } + return hj.Hijack() +}