Skip to content

Commit

Permalink
add Flush method #529 (#538)
Browse files Browse the repository at this point in the history
* add Flush method

* fix doc
  • Loading branch information
emicklei committed Mar 11, 2024
1 parent b3a6f77 commit 951a11c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ func (c *CompressingResponseWriter) CloseNotify() <-chan bool {
return c.writer.(http.CloseNotifier).CloseNotify()
}

// Flush is part of http.Flusher interface. Noop if the underlying writer doesn't support it.
func (c *CompressingResponseWriter) Flush() {
flusher, ok := c.writer.(http.Flusher)
if !ok {
// writer doesn't support http.Flusher interface
return
}
flusher.Flush()
}

// Close the underlying compressor
func (c *CompressingResponseWriter) Close() error {
if c.isCompressorClosed() {
Expand Down

0 comments on commit 951a11c

Please sign in to comment.