Have you tried sending something back from the end...
# http4k
s
Have you tried sending something back from the endpoint? eg:
Copy code
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
Yes, and in the debugger it nver reaches this point, because, as I said , it’s not finding the handler
s
Let me see if I can reproduce it.
@Sandymcp can you try the following curl?
Copy code
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
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/