MCPcopy Create free account
hub / github.com/codehamr/codehamr / sseOK

Function sseOK

internal/llm/llm_test.go:31–38  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

29// OpenAI and vLLM emit it, closed by response.completed carrying the usage.
30func 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
37func writeEvent(w io.Writer, data string) {
38 var ev struct {
39 Type string `json:"type"`
40 }
41 _ = json.Unmarshal([]byte(data), &ev)

Calls

no outgoing calls

Tested by

no test coverage detected