* remove go1.6 support * remove build tag * remove todo * remove go1.6 support: https://github.com/gin-gonic/gin/pull/1383/commits * update readme * remove go1.7 support * fix embedmd error * test * revert it * revert it * remove context_17 * add pusher test * v1.4.0 rc1
This commit is contained in:
@ -16,7 +16,8 @@ const (
|
||||
defaultStatus = http.StatusOK
|
||||
)
|
||||
|
||||
type responseWriterBase interface {
|
||||
// ResponseWriter ...
|
||||
type ResponseWriter interface {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.Flusher
|
||||
@ -37,6 +38,9 @@ type responseWriterBase interface {
|
||||
|
||||
// Forces to write the http header (status code + headers).
|
||||
WriteHeaderNow()
|
||||
|
||||
// get the http.Pusher for server push
|
||||
Pusher() http.Pusher
|
||||
}
|
||||
|
||||
type responseWriter struct {
|
||||
@ -113,3 +117,10 @@ func (w *responseWriter) Flush() {
|
||||
w.WriteHeaderNow()
|
||||
w.ResponseWriter.(http.Flusher).Flush()
|
||||
}
|
||||
|
||||
func (w *responseWriter) Pusher() (pusher http.Pusher) {
|
||||
if pusher, ok := w.ResponseWriter.(http.Pusher); ok {
|
||||
return pusher
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user