Skip to content

Commit bdcdaf7

Browse files
committed
encode: Implement Flush for legacy compatibility
(By sponsor request)
1 parent 9fe694c commit bdcdaf7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

modules/caddyhttp/encode/encode.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,14 @@ func (rw *responseWriter) FlushError() error {
307307
return http.NewResponseController(rw.ResponseWriter).Flush()
308308
}
309309

310+
// Flush calls FlushError() and simply discards any error. It is only implemented for backwards
311+
// compatibility with legacy code that does not use FlushError; we know at least one sponsor
312+
// needs this. It should not be relied upon as a stable part of the exported API, as it may be
313+
// removed in the future.
314+
func (rw *responseWriter) Flush() {
315+
_ = rw.FlushError()
316+
}
317+
310318
// Write writes to the response. If the response qualifies,
311319
// it is encoded using the encoder, which is initialized
312320
// if not done so already.

0 commit comments

Comments
 (0)