I'm using spring-webflux and was returning responses like this:
@GetMapping("test")
public Flux<ServerSentEvent<String>> test() {
return Flux.interval(Duration.ofSeconds(1))
.take(Duration.ofSeconds(3))
.map(i -> ServerSentEvent.builder("Hello " + i).build());
}
The content-type changed when upgrading to 7.0.1.
AS-IS: Content-Type: text/event-stream;charset=UTF-8
TO-BE: Content-Type: application/json
So, I need to change it to the following to get the same behavior as before. Is this intended?
@GetMapping(value = "test", produces = "text/event-stream")
public Flux<ServerSentEvent<String>> test() {
return Flux.interval(Duration.ofSeconds(1))
.take(Duration.ofSeconds(3))
.map(i -> ServerSentEvent.builder("Hello " + i).build());
}