You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When combining multiple HttpApp's when using Tapir's ZioHttpInterpreter().toHttp() middleware ends up applying to NotFound handlers. In the following example, three different HttpApps are combined. Visiting a route that 404's causes the Middleware.requestLogging to print three times. I would expect no log lines since zio.http.Server has its own notFound route handler. This only happens when using Tapir.
The zio-http integration has been quirky before, so not sure if something didn't change as to how we should integrate. But I'm no expert on zio-http codebase, so hard to tell.
Interestingly, if we add a purely zio-http endpoint (e.g. Routes(Method.GET / "c" -> handler(Response.text("Hello World!"))).toHttpApp @@ Middleware.requestLogging()), you only get 1 log entry if you invoke /c, but 3 entries if you invoke a non-existent one.
As a work-around, you can interpret multiple endpoints in one go (it's more efficent, as well):
Tapir version: 1.9.9
Scala version: 2.13.12
When combining multiple HttpApp's when using Tapir's
ZioHttpInterpreter().toHttp()
middleware ends up applying to NotFound handlers. In the following example, three different HttpApps are combined. Visiting a route that 404's causes theMiddleware.requestLogging
to print three times. I would expect no log lines since zio.http.Server has its own notFound route handler. This only happens when using Tapir.Example project: https://github.com/jwcarvana/notfound-middleware-example
The text was updated successfully, but these errors were encountered: