From 2a2f2fa370aca72c7c8e9aa6b0d545ba26c8c140 Mon Sep 17 00:00:00 2001 From: jordan Date: Mon, 9 Feb 2026 13:23:42 -0700 Subject: [PATCH] fix(logging): implement http.Flusher on responseWriter for SSE streaming The logging middleware's responseWriter wrapped http.ResponseWriter but only implemented WriteHeader, Write, and Unwrap. The missing Flush() method caused w.(http.Flusher) type assertions to fail in the claudebox sidecar's streaming endpoint, returning 500 "streaming not supported". Co-Authored-By: Claude Opus 4.6 --- internal/logging/middleware.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/logging/middleware.go b/internal/logging/middleware.go index 120a6bb..7dd847c 100644 --- a/internal/logging/middleware.go +++ b/internal/logging/middleware.go @@ -33,6 +33,13 @@ func (rw *responseWriter) Write(b []byte) (int, error) { return n, err } +// Flush implements http.Flusher, required for SSE streaming through middleware chains. +func (rw *responseWriter) Flush() { + if f, ok := rw.ResponseWriter.(http.Flusher); ok { + f.Flush() + } +} + // Unwrap returns the original http.ResponseWriter, required for http.ResponseController. func (rw *responseWriter) Unwrap() http.ResponseWriter { return rw.ResponseWriter