MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / SetEventStreamHeaders

Function SetEventStreamHeaders

relay/helper/common.go:16–30  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

14)
15
16func SetEventStreamHeaders(c *gin.Context) {
17 // 检查是否已经设置过头部
18 if _, exists := c.Get("event_stream_headers_set"); exists {
19 return
20 }
21
22 c.Writer.Header().Set("Content-Type", "text/event-stream")
23 c.Writer.Header().Set("Cache-Control", "no-cache")
24 c.Writer.Header().Set("Connection", "keep-alive")
25 c.Writer.Header().Set("Transfer-Encoding", "chunked")
26 c.Writer.Header().Set("X-Accel-Buffering", "no")
27
28 // 设置标志,表示头部已经设置过
29 c.Set("event_stream_headers_set", true)
30}
31
32func ClaudeData(c *gin.Context, resp dto.ClaudeResponse) error {
33 jsonData, err := json.Marshal(resp)

Callers 13

doRequestFunction · 0.92
aliStreamHandlerFunction · 0.92
xunfeiStreamHandlerFunction · 0.92
palmStreamHandlerFunction · 0.92
xAIStreamHandlerFunction · 0.92
zhipuStreamHandlerFunction · 0.92
tencentStreamHandlerFunction · 0.92
difyStreamHandlerFunction · 0.92
cohereStreamHandlerFunction · 0.92
cfStreamHandlerFunction · 0.92
cozeChatStreamHandlerFunction · 0.92

Calls 1

GetMethod · 0.80

Tested by

no test coverage detected