Flush keeps SSE handlers working: Echo's Response.Flush goes through http.NewResponseController which walks Unwrap() chains and invokes Flush on the first wrapper that implements http.Flusher. By implementing it here we both stamp the header before the underlying writer flushes AND keep the streamin
()
| 56 | // here we both stamp the header before the underlying writer flushes AND |
| 57 | // keep the streaming path alive. |
| 58 | func (w *nodeHeaderWriter) Flush() { |
| 59 | w.maybeSet() |
| 60 | if f, ok := w.ResponseWriter.(http.Flusher); ok { |
| 61 | f.Flush() |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | // Hijack preserves WebSocket / raw-conn handlers that need to take over the |
| 66 | // underlying TCP connection (e.g. /v1/realtime). Without this the wrapper |