refactor: add back trim & flush
This commit is contained in:
parent
616759933a
commit
d05344c543
@ -5,10 +5,14 @@ import (
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/songquanpeng/one-api/common"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func StringData(c *gin.Context, str string) {
|
||||
str = strings.TrimPrefix(str, "data: ")
|
||||
str = strings.TrimSuffix(str, "\r")
|
||||
c.Render(-1, common.CustomEvent{Data: "data: " + str})
|
||||
c.Writer.Flush()
|
||||
}
|
||||
|
||||
func ObjectData(c *gin.Context, object interface{}) error {
|
||||
|
Loading…
Reference in New Issue
Block a user