Enforce "data: " prefix for outgoing SSE data payloads

Prior to this commit, SSE support in Spring would write payloads with
the "data:" prefix (without space). While this is OK with the standard,
this makes it harder for implementations to support reading and writing
payloads with Spring (the round trip use case).

This commit introduces a breaking change and now enforces "data: " in
all variants. This has the potential of breaking some low level test
suites with text/plain or custom media types, but this should overall
make the situation better for developers.

Closes gh-37242
This commit is contained in:
Brian Clozel
2026-09-04 16:21:13 +02:00
parent 21bb726934
commit 60e5abff7f
22 changed files with 102 additions and 99 deletions
@@ -52,7 +52,7 @@ class ReactiveReturnTypeTests {
.andReturn();
mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(content().string("data:event0\n\ndata:event1\n\ndata:event2\n\n"));
.andExpect(content().string("data: event0\n\ndata: event1\n\ndata: event2\n\n"));
}