Skip to content

Getting 405 Method Not Allowed from combined routes #492

Open
@hoshikon

Description

@hoshikon

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.

    val routes1 = new RhoRoutes[IO] {
      GET / "path" |>> { () => Ok("good") }
    }.toRoutes()

    val routes2 = new RhoRoutes[IO] {
      POST / "path" |>> { () => Ok("good") }
    }.toRoutes()

    val combinedRoutes = routes1 <+> routes2

    val req = Request[IO](Method.POST, Uri(path = "/path"))
    val response = combinedRoutes.orNotFound.run(req).unsafeRunSync()
    response.status shouldBe Status.Ok   // fails because it returns MethodNotFound instead

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions