fix(logging): implement http.Flusher on responseWriter for SSE streaming
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

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 <noreply@anthropic.com>
This commit is contained in:
jordan 2026-02-09 13:23:42 -07:00
parent 6ec2a4fea3
commit 2a2f2fa370

View File

@ -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