sseOK writes an OpenAI-style streamed response plus a [DONE] terminator. The budget header travels on the 200 like in production.
(w http.ResponseWriter, chunks []string)
| 29 | // OpenAI and vLLM emit it, closed by response.completed carrying the usage. |
| 30 | func sseOK(w http.ResponseWriter, events []string) { |
| 31 | w.Header().Set("Content-Type", "text/event-stream") |
| 32 | for _, e := range events { |
| 33 | writeEvent(w, e) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | func writeEvent(w io.Writer, data string) { |
| 38 | var ev struct { |
| 39 | Type string `json:"type"` |
| 40 | } |
| 41 | _ = json.Unmarshal([]byte(data), &ev) |
no outgoing calls
no test coverage detected