另客网go项目公用的代码库

response_writer_1.8.go 498B

1234567891011121314151617181920212223242526
  1. // +build go1.8
  2. // Copyright 2018 Gin Core Team. All rights reserved.
  3. // Use of this source code is governed by a MIT style
  4. // license that can be found in the LICENSE file.
  5. package gin
  6. import (
  7. "net/http"
  8. )
  9. // ResponseWriter ...
  10. type ResponseWriter interface {
  11. responseWriterBase
  12. // get the http.Pusher for server push
  13. Pusher() http.Pusher
  14. }
  15. func (w *responseWriter) Pusher() (pusher http.Pusher) {
  16. if pusher, ok := w.ResponseWriter.(http.Pusher); ok {
  17. return pusher
  18. }
  19. return nil
  20. }