mirror of https://github.com/gin-gonic/gin.git
More unit tests for ResponseWriter
This commit is contained in:
parent
a28104fa21
commit
c61c547539
|
@ -79,7 +79,9 @@ 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) {
|
||||||
w.size = 0 // this prevents Gin to write the HTTP headers
|
if w.size < 0 {
|
||||||
|
w.size = 0
|
||||||
|
}
|
||||||
return w.ResponseWriter.(http.Hijacker).Hijack()
|
return w.ResponseWriter.(http.Hijacker).Hijack()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@ import (
|
||||||
var _ ResponseWriter = &responseWriter{}
|
var _ ResponseWriter = &responseWriter{}
|
||||||
var _ http.ResponseWriter = &responseWriter{}
|
var _ http.ResponseWriter = &responseWriter{}
|
||||||
var _ http.ResponseWriter = ResponseWriter(&responseWriter{})
|
var _ http.ResponseWriter = ResponseWriter(&responseWriter{})
|
||||||
|
var _ http.Hijacker = ResponseWriter(&responseWriter{})
|
||||||
|
var _ http.Flusher = ResponseWriter(&responseWriter{})
|
||||||
|
var _ http.CloseNotifier = ResponseWriter(&responseWriter{})
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
SetMode(TestMode)
|
SetMode(TestMode)
|
||||||
|
|
Loading…
Reference in New Issue