The whole project generated from Intializr: Spring Boot 2.0.0 with Kotlin 1.2.31.
Run the application and access the resource directly through Safari: http://localhost:8080/books
Instead of receiving a book every second, Safari waits for as long as the Flux.zip() takes and then it receives the whole list of books.
Thanks for the report, but Safari does properly support SSE with WebFlux.
The issue seems to be with your RouterFunction only accepting MediaType.APPLICATION_JSON for this endpoint. This might work with some browsers, if they send an Accept header that's flexible (maybe accepting "\*/\*"?).
Safari seems to be more restrictive and sends an "Accept: text/event-stream" request header for SSE requests done with EventSource. In this case, the server responds with an HTTP 404...
Changing that part in your sample with the following works:
@Bean
fun booksRouter(handler: BooksHandler) = router {
GET("/", handler::home)
("/books" and accept(MediaType.TEXT_EVENT_STREAM)).nest {
GET("/", handler::getAll)
}
}
Adrian Marszałek opened SPR-16691 and commented
Complete source code:
The whole project generated from Intializr: Spring Boot 2.0.0 with Kotlin 1.2.31.
Run the application and access the resource directly through Safari: http://localhost:8080/books
Instead of receiving a book every second, Safari waits for as long as the Flux.zip() takes and then it receives the whole list of books.
No further details from SPR-16691
The text was updated successfully, but these errors were encountered: