fix: SSE flusher support, null-safe API responses

- Add Flush() to statusRecorder so SSE works through logging middleware
- Return empty array instead of null for empty project lists
- Fixes 500 on /api/events and null.length crash on dashboard
This commit is contained in:
2026-03-28 13:48:20 +03:00
parent a8fcde87b5
commit 28abad27c6
2 changed files with 10 additions and 0 deletions
+7
View File
@@ -72,3 +72,10 @@ func (r *statusRecorder) WriteHeader(code int) {
r.status = code
r.ResponseWriter.WriteHeader(code)
}
// Flush delegates to the underlying ResponseWriter if it supports http.Flusher (needed for SSE).
func (r *statusRecorder) Flush() {
if f, ok := r.ResponseWriter.(http.Flusher); ok {
f.Flush()
}
}