-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting 405 Method Not Allowed from combined routes #492
Comments
This is a bit of a tricky one. We have 2 choice based on how the frameworks work.
After some thought, I'm inclined to leave the functionally as is. Rho was not designed for you to convert 2 sets of Unless you have some edge case where you intend to create separate swagger documents within a single application, there shouldn't be any issues here. |
I'd be curious if @rossabaker has any thoughts on this? |
I've hit this same issue. object Auth extends org.http4s.rho.AuthedContext[IO, AuthInfo]
val routes1 = new RhoRoutes[IO] {
GET / "path" |>> { () => Ok("good") }
}
val routes2 = new RhoRoutes[IO] {
POST / "path" >>> Auth.auth() |>> { (_: AuthInfo) => Ok("good") }
}
val combinedRoutes = routes1.toRoutes() <+> routes2.toRoutes() In order to auth, routes2 needs to be wrapped in authMiddleware. However, if I compose the RhoRoutes first, then routes1 will also be wrapped in middleware and then return a 401 when no header is supplied. Whilst it's probably not technically correct, any thoughts on including a param to enable copying the http4s behaviour if desired? |
When I combine these routes and hit the second route, it returns 405 Method Not Allowed. I don't know if this is intended or a bug but I would prefer to have it aligned with http4s library.
The text was updated successfully, but these errors were encountered: