MCPcopy
hub / github.com/mudler/LocalAI / Flush

Method Flush

core/http/middleware/node_header.go:58–63  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

56// here we both stamp the header before the underlying writer flushes AND
57// keep the streaming path alive.
58func (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

Callers

nothing calls this directly

Calls 1

maybeSetMethod · 0.95

Tested by

no test coverage detected