mirror of
https://github.com/router-for-me/CLIProxyAPIPlus.git
synced 2026-04-26 21:25:53 +00:00
fix: simplify responses SSE suffix handling
This commit is contained in:
@@ -32,14 +32,12 @@ func writeResponsesSSEChunk(w io.Writer, chunk []byte) {
|
|||||||
if bytes.HasSuffix(chunk, []byte("\n\n")) {
|
if bytes.HasSuffix(chunk, []byte("\n\n")) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
suffix := []byte("\n\n")
|
||||||
if bytes.HasSuffix(chunk, []byte("\n")) {
|
if bytes.HasSuffix(chunk, []byte("\n")) {
|
||||||
if _, err := w.Write([]byte("\n")); err != nil {
|
suffix = []byte("\n")
|
||||||
return
|
}
|
||||||
}
|
if _, err := w.Write(suffix); err != nil {
|
||||||
} else {
|
return
|
||||||
if _, err := w.Write([]byte("\n\n")); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user