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:
@@ -138,6 +138,20 @@ public class ServerSentEventHttpMessageReaderTests extends AbstractLeakCheckingT
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void trimWhitespace() {
|
||||
MockServerHttpRequest request = MockServerHttpRequest.post("/")
|
||||
.body(Mono.just(stringBuffer("data: \tfoo \ndata:bar\t\n\n")));
|
||||
|
||||
Flux<String> data = reader.read(ResolvableType.forClass(String.class),
|
||||
request, Collections.emptyMap()).cast(String.class);
|
||||
|
||||
StepVerifier.create(data)
|
||||
.expectNext("\tfoo \nbar\t")
|
||||
.expectComplete()
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readPojo() {
|
||||
MockServerHttpRequest request = MockServerHttpRequest.post("/")
|
||||
|
||||
Reference in New Issue
Block a user