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

Function StringData

relay/helper/common.go:64–74  ·  view source on GitHub ↗
(c *gin.Context, str string)

Source from the content-addressed store, hash-verified

62}
63
64func StringData(c *gin.Context, str string) error {
65 //str = strings.TrimPrefix(str, "data: ")
66 //str = strings.TrimSuffix(str, "\r")
67 c.Render(-1, common.CustomEvent{Data: "data: " + str})
68 if flusher, ok := c.Writer.(http.Flusher); ok {
69 flusher.Flush()
70 } else {
71 return errors.New("streaming error: flusher not found")
72 }
73 return nil
74}
75
76func PingData(c *gin.Context) error {
77 c.Writer.Write([]byte(": PING\n\n"))

Callers 4

sendStreamDataFunction · 0.92
ObjectDataFunction · 0.85
DoneFunction · 0.85

Calls 1

RenderMethod · 0.80

Tested by

no test coverage detected