Remove only leading space for SSE data
Prior to this commit, all white space was trimmed from Server Sent Event data. After this commit, only a leading space is removed (if present). Closes gh-27473
This commit is contained in:
@@ -147,7 +147,13 @@ public class ServerSentEventHttpMessageReader implements HttpMessageReader<Objec
|
||||
for (String line : lines) {
|
||||
if (line.startsWith("data:")) {
|
||||
data = (data != null ? data : new StringBuilder());
|
||||
data.append(line.substring(5).trim()).append('\n');
|
||||
if (line.charAt(5) != ' ') {
|
||||
data.append(line, 5, line.length());
|
||||
}
|
||||
else {
|
||||
data.append(line, 6, line.length());
|
||||
}
|
||||
data.append('\n');
|
||||
}
|
||||
if (shouldWrap) {
|
||||
if (line.startsWith("id:")) {
|
||||
|
||||
Reference in New Issue
Block a user