SseEmitter support for multiline String

Closes gh-30965
This commit is contained in:
rstoyanchev
2023-09-20 17:52:52 +01:00
parent 9350091163
commit 2530efd1c7
2 changed files with 13 additions and 0 deletions

View File

@@ -104,6 +104,16 @@ public class SseEmitterTests {
this.handler.assertWriteCount(1);
}
@Test
public void sendEventWithMultiline() throws Exception {
this.emitter.send(event().data("foo\nbar\nbaz"));
this.handler.assertSentObjectCount(3);
this.handler.assertObject(0, "data:", TEXT_PLAIN_UTF8);
this.handler.assertObject(1, "foo\ndata:bar\ndata:baz");
this.handler.assertObject(2, "\n\n", TEXT_PLAIN_UTF8);
this.handler.assertWriteCount(1);
}
@Test
public void sendEventFull() throws Exception {
this.emitter.send(event().comment("blah").name("test").reconnectTime(5000L).id("1").data("foo"));