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 | // sseOK writes an OpenAI-style streamed response plus a [DONE] terminator. The |
| 30 | // budget header travels on the 200 like in production. |
| 31 | func sseOK(w http.ResponseWriter, chunks []string) { |
| 32 | w.Header().Set("Content-Type", "text/event-stream") |
| 33 | w.Header().Set("X-Budget-Remaining", "0.73") |
| 34 | for _, c := range chunks { |
| 35 | fmt.Fprintf(w, "data: %s\n\n", c) |
| 36 | } |
| 37 | fmt.Fprint(w, "data: [DONE]\n\n") |
| 38 | } |
| 39 | |
| 40 | // TestChatStreamsContent: content deltas merge into one final string. |
| 41 | func TestChatStreamsContent(t *testing.T) { |
no outgoing calls
no test coverage detected