The ResponseWriters defined in rest.handler add Flush interface. (#318)

This commit is contained in:
jichangyun
2020-12-28 21:30:24 +08:00
committed by GitHub
parent 71a2b20301
commit 0bd2a0656c
8 changed files with 88 additions and 0 deletions

View File

@@ -19,3 +19,9 @@ func (w *WithCodeResponseWriter) WriteHeader(code int) {
w.Writer.WriteHeader(code)
w.Code = code
}
func (w *WithCodeResponseWriter) Flush() {
if flusher, ok := w.Writer.(http.Flusher); ok {
flusher.Flush()
}
}