mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-23 14:40:00 +00:00
Always process SSE "data:" line
ServerSentEventHttpMessageReader now always processes "data:" lines, including empty lines, as per SSE spec. Closes gh-35412
This commit is contained in:
+2
-2
@@ -145,15 +145,15 @@ public class ServerSentEventHttpMessageReader implements HttpMessageReader<Objec
|
||||
|
||||
for (String line : lines) {
|
||||
if (line.startsWith("data:")) {
|
||||
data = (data != null ? data : new StringBuilder());
|
||||
int length = line.length();
|
||||
if (length > 5) {
|
||||
int index = (line.charAt(5) != ' ' ? 5 : 6);
|
||||
if (length > index) {
|
||||
data = (data != null ? data : new StringBuilder());
|
||||
data.append(line, index, line.length());
|
||||
data.append('\n');
|
||||
}
|
||||
}
|
||||
data.append('\n');
|
||||
}
|
||||
else if (shouldWrap) {
|
||||
if (line.startsWith("id:")) {
|
||||
|
||||
Reference in New Issue
Block a user