fix: address responses SSE review feedback
This commit is contained in:
@@ -26,13 +26,15 @@ func writeResponsesSSEChunk(w io.Writer, chunk []byte) {
|
||||
if w == nil || len(chunk) == 0 {
|
||||
return
|
||||
}
|
||||
_, _ = w.Write(chunk)
|
||||
switch {
|
||||
case bytes.HasSuffix(chunk, []byte("\n\n")):
|
||||
if _, err := w.Write(chunk); err != nil {
|
||||
return
|
||||
case bytes.HasSuffix(chunk, []byte("\n")):
|
||||
}
|
||||
if bytes.HasSuffix(chunk, []byte("\n\n")) {
|
||||
return
|
||||
}
|
||||
if bytes.HasSuffix(chunk, []byte("\n")) {
|
||||
_, _ = w.Write([]byte("\n"))
|
||||
default:
|
||||
} else {
|
||||
_, _ = w.Write([]byte("\n\n"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user