More unit tests for ResponseWriter

This commit is contained in:
Manu Mtz-Almeida 2015-04-08 15:20:39 +02:00
parent a28104fa21
commit c61c547539
2 changed files with 6 additions and 1 deletions

View File

@ -79,7 +79,9 @@ func (w *responseWriter) Written() bool {
// Implements the http.Hijacker interface
func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
w.size = 0 // this prevents Gin to write the HTTP headers
if w.size < 0 {
w.size = 0
}
return w.ResponseWriter.(http.Hijacker).Hijack()
}

View File

@ -15,6 +15,9 @@ import (
var _ ResponseWriter = &responseWriter{}
var _ http.ResponseWriter = &responseWriter{}
var _ http.ResponseWriter = ResponseWriter(&responseWriter{})
var _ http.Hijacker = ResponseWriter(&responseWriter{})
var _ http.Flusher = ResponseWriter(&responseWriter{})
var _ http.CloseNotifier = ResponseWriter(&responseWriter{})
func init() {
SetMode(TestMode)