leonhardt
04/27/2025, 11:13 PMroutes(emptyList())
I get:
Exception in thread "main" java.lang.IllegalArgumentException: No routes added!
at org.http4k.routing.RoutingHandler.<init>(RoutingHandler.kt:19)
at org.http4k.routing.RoutingHttpHandler.<init>(http.kt:23)
leonhardt
04/27/2025, 11:13 PMroutes(
"/api" bind routes(
"/login" bind Method.POST to authenticationEndpoints.login,
),
clockProvider.routes, // trying to sometimes return no routes here
uiEndpoints.routes,
)
James Richardson
04/28/2025, 5:49 AMJames Richardson
04/28/2025, 5:50 AMdave
04/28/2025, 12:45 PMorElse bind { Response(NOT_FOUND} }
as a defaultleonhardt
04/30/2025, 9:13 PMleonhardt
04/30/2025, 9:14 PMuiEndpoints.routes
wouldn't have a chance to match. Is there a way to create a RoutingHttpHandler that doesn't match anything?James Richardson
05/01/2025, 1:01 AMleonhardt
05/01/2025, 1:32 AMroutes("/test/clock" bind Method.POST to { Response(Status.FORBIDDEN) })
so that the server's regular fallback routes can catch what they're supposed to.
But I'd rather find a way to instantiate a RoutingHttpHandler that truly doesn't match anything as that makes the intention a little clearer (for future me, or other team members).
I'm also reconsidering your suggestion to use an HTTP Header instead of an HttpHandler to communicate the time from tests to server and moving my Clock from DI to a RequestContext. But that would require more changes just for test within our UI layer (which is what calls the http4k routes), and maybe I'm being stubborn but I feel like there should be a way to instantiate a RoutingHttpHandler that doesn't match any routes and I just haven't figured it out.dave
05/01/2025, 5:56 PM