From f8a432311767edaffe971d22c9ce5d81227eb36c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cipriani=20Bandarra?= Date: Sat, 31 Jan 2026 06:40:45 +0000 Subject: [PATCH] Fix SSE data field to append instead of overwrite Per the SSE specification, multiple data: lines within a single event should be concatenated with newline separators. Previously, each data: line overwrote the previous value. --- src/network/event_source.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/network/event_source.rs b/src/network/event_source.rs index eae9932..53eaff9 100644 --- a/src/network/event_source.rs +++ b/src/network/event_source.rs @@ -73,7 +73,12 @@ impl Decoder for ServerSentEventsCodec { self.next.event = Some(line); } else if line.starts_with(DATA) { line.drain(..DATA.len()); - self.next.data = Some(line) + if let Some(ref mut existing) = self.next.data { + existing.push('\n'); + existing.push_str(&line); + } else { + self.next.data = Some(line); + } } else if line.starts_with(ID) { line.drain(..ID.len()); self.next.id = Some(line);