flush operation will overwrite the origin status code (#1460)

The status of responseWriter will be overwrite if flush was called. This is caused by the Flush of http.response.Flush().
This commit is contained in:
zhanweidu
2018-08-07 12:41:28 +08:00
committed by Bo-Yi Wu
parent 9b7e7bdce6
commit 0552c3bc3a
2 changed files with 17 additions and 0 deletions

View File

@ -110,5 +110,6 @@ func (w *responseWriter) CloseNotify() <-chan bool {
// Flush implements the http.Flush interface.
func (w *responseWriter) Flush() {
w.WriteHeaderNow()
w.ResponseWriter.(http.Flusher).Flush()
}