diff --git a/server/tests/src/main/scala/sttp/tapir/server/tests/ServerBasicTests.scala b/server/tests/src/main/scala/sttp/tapir/server/tests/ServerBasicTests.scala index f44fef582c..0c36b93340 100644 --- a/server/tests/src/main/scala/sttp/tapir/server/tests/ServerBasicTests.scala +++ b/server/tests/src/main/scala/sttp/tapir/server/tests/ServerBasicTests.scala @@ -690,6 +690,22 @@ class ServerBasicTests[F[_], OPTIONS, ROUTE]( basicRequest.get(uri"$baseUri/p1/abc").send(backend).map(_.code shouldBe StatusCode.BadRequest) >> basicRequest.post(uri"$baseUri/p1/123").send(backend).map(_.code shouldBe StatusCode.Ok) >> basicRequest.post(uri"$baseUri/p1/abc").send(backend).map(_.code shouldBe StatusCode.Ok) + }, + testServer( + "two endpoints with fixed path & path capture as the middle component", + NonEmptyList.of( + route( + List[ServerEndpoint[Any, F]]( + endpoint.get.in("p1" / "p2" / "p3").out(stringBody).serverLogic(_ => pureResult("1".asRight[Unit])), + endpoint.get.in("p1" / path[String]("p") / "p3").out(stringBody).serverLogic((v: String) => pureResult(s"2: $v".asRight[Unit])) + ) + ) + ) + ) { (backend, baseUri) => + basicRequest.get(uri"$baseUri/p1/p2/p3").send(backend).map(_.body shouldBe Right("1")) >> + basicRequest.get(uri"$baseUri/p1/x/p3").send(backend).map(_.body shouldBe Right("2: x")) >> + basicRequest.get(uri"$baseUri/p1/y/p3").send(backend).map(_.body shouldBe Right("2: y")) >> + basicRequest.get(uri"$baseUri/p1/p2/p4").send(backend).map(_.code shouldBe StatusCode.NotFound) } )