From 251b73fc70c4f75487ec827be7b0c3a3e877e11a Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Mon, 23 Mar 2015 04:45:03 +0100 Subject: [PATCH] Fixes #239 bug --- response_writer.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/response_writer.go b/response_writer.go index 98993958..a8cd775b 100644 --- a/response_writer.go +++ b/response_writer.go @@ -79,11 +79,8 @@ func (w *responseWriter) Written() bool { // Implements the http.Hijacker interface func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { - hijacker, ok := w.ResponseWriter.(http.Hijacker) - if !ok { - return nil, nil, errors.New("the ResponseWriter doesn't support the Hijacker interface") - } - return hijacker.Hijack() + w.size = 0 // this prevents Gin to write the HTTP headers + return w.ResponseWriter.(http.Hijacker).Hijack() } // Implements the http.CloseNotify interface