This commit is contained in:
Manu Mtz-Almeida 2015-03-23 04:45:03 +01:00
parent 8f31fbc502
commit 251b73fc70
1 changed files with 2 additions and 5 deletions

View File

@ -79,11 +79,8 @@ func (w *responseWriter) Written() bool {
// Implements the http.Hijacker interface // Implements the http.Hijacker interface
func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
hijacker, ok := w.ResponseWriter.(http.Hijacker) w.size = 0 // this prevents Gin to write the HTTP headers
if !ok { return w.ResponseWriter.(http.Hijacker).Hijack()
return nil, nil, errors.New("the ResponseWriter doesn't support the Hijacker interface")
}
return hijacker.Hijack()
} }
// Implements the http.CloseNotify interface // Implements the http.CloseNotify interface