Skip to content

Commit

Permalink
feat: flush writes to http response on every chunk
Browse files Browse the repository at this point in the history
Signed-off-by: Itay Ariel <[email protected]>
  • Loading branch information
itayariel committed Aug 29, 2023
1 parent 0321ee0 commit a309893
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions interceptor/middleware/loggingresponsewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ func (lrw *loggingResponseWriter) Header() http.Header {

func (lrw *loggingResponseWriter) Write(bytes []byte) (int, error) {
n, err := lrw.downstreamResponseWriter.Write(bytes)
if f, ok := lrw.downstreamResponseWriter.(http.Flusher); ok {
f.Flush()
}

lrw.bytesWritten += n

Expand Down

0 comments on commit a309893

Please sign in to comment.