refactor: refactor relay part (#935)

This commit is contained in:
JustSong
2024-01-14 19:21:03 +08:00
committed by GitHub
parent f2c51a494c
commit eed9f5fdf0
37 changed files with 1527 additions and 1437 deletions

View File

@@ -31,3 +31,11 @@ func UnmarshalBodyReusable(c *gin.Context, v any) error {
c.Request.Body = io.NopCloser(bytes.NewBuffer(requestBody))
return nil
}
func SetEventStreamHeaders(c *gin.Context) {
c.Writer.Header().Set("Content-Type", "text/event-stream")
c.Writer.Header().Set("Cache-Control", "no-cache")
c.Writer.Header().Set("Connection", "keep-alive")
c.Writer.Header().Set("Transfer-Encoding", "chunked")
c.Writer.Header().Set("X-Accel-Buffering", "no")
}