From 163910e74eb22177cf0ceff654923475f185f1d1 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 16 Feb 2026 15:59:10 -0700 Subject: [PATCH] encode: Implement Flush for legacy compatibility (By sponsor request) --- modules/caddyhttp/encode/encode.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/caddyhttp/encode/encode.go b/modules/caddyhttp/encode/encode.go index bea86083a..7459c856a 100644 --- a/modules/caddyhttp/encode/encode.go +++ b/modules/caddyhttp/encode/encode.go @@ -295,6 +295,14 @@ func (rw *responseWriter) FlushError() error { return http.NewResponseController(rw.ResponseWriter).Flush() } +// Flush calls FlushError() and simply discards any error. It is only implemented for backwards +// compatibility with legacy code that does not use FlushError; we know at least one sponsor +// needs this. It should not be relied upon as a stable part of the exported API, as it may be +// removed in the future. +func (rw *responseWriter) Flush() { + _ = rw.FlushError() +} + // Write writes to the response. If the response qualifies, // it is encoded using the encoder, which is initialized // if not done so already.