refactor: refactor relay part

This commit is contained in:
JustSong
2024-01-14 19:18:18 +08:00
parent f2c51a494c
commit e12b0c7aa8
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")
}