Imply text/event-stream when serializing ServerSentEvent

Issue: SPR-14748
This commit is contained in:
Sebastien Deleuze
2016-09-27 09:27:23 +02:00
parent fb7ae010c8
commit 44ceecc8b3
3 changed files with 21 additions and 2 deletions

View File

@@ -120,6 +120,24 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
);
}
@Test
public void sseAsEventWithoutAcceptHeader() throws Exception {
Flux<String> result = this.webClient
.perform(get("http://localhost:" + port + "/sse/event"))
.extract(bodyStream(String.class))
.filter(s -> !s.equals("\n"))
.map(s -> s.replace("\n", ""))
.take(2);
TestSubscriber
.subscribe(result)
.await(Duration.ofSeconds(5))
.assertValues(
"id:0:bardata:foo",
"id:1:bardata:foo"
);
}
@RestController
@SuppressWarnings("unused")
static class SseController {