diff --git a/api/metrics.go b/api/metrics.go index eaa0c15c0..eb629120c 100644 --- a/api/metrics.go +++ b/api/metrics.go @@ -286,6 +286,12 @@ func (w *responseWrapper) Flush() { } } +func (w *writeCounter) Flush() { + if f, ok := w.ResponseWriter.(http.Flusher); ok { + f.Flush() + } +} + func (w *writeCounter) Write(p []byte) (int, error) { n, err := w.ResponseWriter.Write(p) atomic.AddUint64(&w.countBytes, uint64(n)) diff --git a/api/router.go b/api/router.go index a7fd2a4bc..66f4a0bc8 100644 --- a/api/router.go +++ b/api/router.go @@ -117,6 +117,12 @@ func (lrw *logResponseWriter) WriteHeader(code int) { }) } +func (lrw *logResponseWriter) Flush() { + if f, ok := lrw.ResponseWriter.(http.Flusher); ok { + f.Flush() + } +} + func setRequestID(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // generate random UUIDv4