https://kotlinlang.org logo
Title
s

s4nchez

10/05/2021, 1:48 PM
Have you tried sending something back from the endpoint? eg:
val sse = sse(
            "/hello" bind sse(
                "/{name}" bind { sse: Sse ->
                    val name = sse.connectRequest.path("name")!!
                    sse.send(Event("event1", "hello $name", "123"))
                    sse.send(Event("event2", "again $name", "456"))
                    sse.send(Data("goodbye $name".byteInputStream()))
                }
            )
        )
s

Sandymcp

10/05/2021, 1:49 PM
Yes, and in the debugger it nver reaches this point, because, as I said , it’s not finding the handler
s

s4nchez

10/05/2021, 1:52 PM
Let me see if I can reproduce it.
@Sandymcp can you try the following curl?
curl --http2 -H "Accept:text/event-stream" <http://localhost:8080/test>
You example gives me NPE with a normal curl (as that’s not stating you want an event stream), but works with the command above.
s

Sandymcp

10/05/2021, 2:14 PM
Ok, but then it should return 406 not accepted?
and not a 500 and certainly not a 404 when there is a normal http handler present.
Ok I could put a filter in front of the SSE handler, catch the NPE and check the headers and return 406 myself. Of course if I were to need an http handler on the same port then Undertow would give me the unwanted 404/