diff --git a/internal/api/server.go b/internal/api/server.go index a170bb2..12f48b2 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -147,6 +147,16 @@ func (sw *statusWriter) WriteHeader(code int) { sw.ResponseWriter.WriteHeader(code) } +// Flush forwards to the underlying ResponseWriter when it implements Flusher. +// Without this method, the type assertion `w.(http.Flusher)` in the SSE handlers +// fails (the wrapper hides the inner Flusher), and the handler aborts with +// "streaming unsupported". +func (sw *statusWriter) Flush() { + if f, ok := sw.ResponseWriter.(http.Flusher); ok { + f.Flush() + } +} + // --- Helpers --- func writeJSON(w http.ResponseWriter, status int, v any) {