diff --git a/examples/src/main/scala/sttp/tapir/examples/BooksExample.scala b/examples/src/main/scala/sttp/tapir/examples/BooksExample.scala index b05af7080f..93f84262fa 100644 --- a/examples/src/main/scala/sttp/tapir/examples/BooksExample.scala +++ b/examples/src/main/scala/sttp/tapir/examples/BooksExample.scala @@ -143,7 +143,7 @@ object BooksExample extends App with StrictLogging { import scala.concurrent.duration._ val routes = concat(route, new SwaggerAkka(yaml).routes) implicit val actorSystem: ActorSystem = ActorSystem() - Await.result(Http().bindAndHandle(routes, "localhost", 8080), 1.minute) + Await.result(Http().newServerAt("localhost", 8080).bindFlow(routes), 1.minute) logger.info("Server started") } diff --git a/examples/src/main/scala/sttp/tapir/examples/CustomErrorsOnDecodeFailureAkkaServer.scala b/examples/src/main/scala/sttp/tapir/examples/CustomErrorsOnDecodeFailureAkkaServer.scala index d6679bafff..0625d581ea 100644 --- a/examples/src/main/scala/sttp/tapir/examples/CustomErrorsOnDecodeFailureAkkaServer.scala +++ b/examples/src/main/scala/sttp/tapir/examples/CustomErrorsOnDecodeFailureAkkaServer.scala @@ -36,7 +36,7 @@ object CustomErrorsOnDecodeFailureAkkaServer extends App { implicit val actorSystem: ActorSystem = ActorSystem() import actorSystem.dispatcher - val bindAndCheck = Http().bindAndHandle(amountRoute, "localhost", 8080).map { _ => + val bindAndCheck = Http().newServerAt("localhost", 8080).bindFlow(amountRoute).map { _ => // testing implicit val backend: SttpBackend[Identity, Nothing, NothingT] = HttpURLConnectionBackend() diff --git a/examples/src/main/scala/sttp/tapir/examples/ErrorOutputsAkkaServer.scala b/examples/src/main/scala/sttp/tapir/examples/ErrorOutputsAkkaServer.scala index 27dc1e2074..54c84088a7 100644 --- a/examples/src/main/scala/sttp/tapir/examples/ErrorOutputsAkkaServer.scala +++ b/examples/src/main/scala/sttp/tapir/examples/ErrorOutputsAkkaServer.scala @@ -32,7 +32,7 @@ object ErrorOutputsAkkaServer extends App { implicit val actorSystem: ActorSystem = ActorSystem() import actorSystem.dispatcher - val bindAndCheck = Http().bindAndHandle(errorOrJsonRoute, "localhost", 8080).map { _ => + val bindAndCheck = Http().newServerAt("localhost", 8080).bindFlow(errorOrJsonRoute).map { _ => // testing implicit val backend: SttpBackend[Identity, Nothing, NothingT] = HttpURLConnectionBackend() diff --git a/examples/src/main/scala/sttp/tapir/examples/HelloWorldAkkaServer.scala b/examples/src/main/scala/sttp/tapir/examples/HelloWorldAkkaServer.scala index b5f1314335..25d2df9953 100644 --- a/examples/src/main/scala/sttp/tapir/examples/HelloWorldAkkaServer.scala +++ b/examples/src/main/scala/sttp/tapir/examples/HelloWorldAkkaServer.scala @@ -23,7 +23,7 @@ object HelloWorldAkkaServer extends App { implicit val actorSystem: ActorSystem = ActorSystem() import actorSystem.dispatcher - val bindAndCheck = Http().bindAndHandle(helloWorldRoute, "localhost", 8080).map { _ => + val bindAndCheck = Http().newServerAt("localhost", 8080).bindFlow(helloWorldRoute).map { _ => // testing implicit val backend: SttpBackend[Identity, Nothing, NothingT] = HttpURLConnectionBackend() val result: String = basicRequest.response(asStringAlways).get(uri"http://localhost:8080/hello?name=Frodo").send().body diff --git a/examples/src/main/scala/sttp/tapir/examples/MultipartFormUploadAkkaServer.scala b/examples/src/main/scala/sttp/tapir/examples/MultipartFormUploadAkkaServer.scala index a24d9adf8c..dca272bb9b 100644 --- a/examples/src/main/scala/sttp/tapir/examples/MultipartFormUploadAkkaServer.scala +++ b/examples/src/main/scala/sttp/tapir/examples/MultipartFormUploadAkkaServer.scala @@ -40,7 +40,7 @@ object MultipartFormUploadAkkaServer extends App { // starting the server implicit val actorSystem: ActorSystem = ActorSystem() import actorSystem.dispatcher - val bindAndCheck = Http().bindAndHandle(setProfileRoute, "localhost", 8080).map { _ => + val bindAndCheck = Http().newServerAt("localhost", 8080).bindFlow(setProfileRoute).map { _ => val testFile = File.createTempFile("user-123", ".jpg") val pw = new PrintWriter(testFile); pw.write("This is not a photo"); pw.close() diff --git a/examples/src/main/scala/sttp/tapir/examples/MultipleEndpointsDocumentationAkkaServer.scala b/examples/src/main/scala/sttp/tapir/examples/MultipleEndpointsDocumentationAkkaServer.scala index 56e2ecf052..3326594481 100644 --- a/examples/src/main/scala/sttp/tapir/examples/MultipleEndpointsDocumentationAkkaServer.scala +++ b/examples/src/main/scala/sttp/tapir/examples/MultipleEndpointsDocumentationAkkaServer.scala @@ -65,7 +65,7 @@ object MultipleEndpointsDocumentationAkkaServer extends App { concat(booksListingRoute, addBookRoute, new SwaggerAkka(openApiYml).routes) } - val bindAndCheck = Http().bindAndHandle(routes, "localhost", 8080).map { _ => + val bindAndCheck = Http().newServerAt("localhost", 8080).bindFlow(routes).map { _ => // testing println("Go to: http://localhost:8080/docs") println("Press any key to exit ...") diff --git a/examples/src/main/scala/sttp/tapir/examples/MultipleServerEndpointsAkkaServer.scala b/examples/src/main/scala/sttp/tapir/examples/MultipleServerEndpointsAkkaServer.scala index 9f96748180..f5bc7d46dc 100644 --- a/examples/src/main/scala/sttp/tapir/examples/MultipleServerEndpointsAkkaServer.scala +++ b/examples/src/main/scala/sttp/tapir/examples/MultipleServerEndpointsAkkaServer.scala @@ -23,7 +23,7 @@ object MultipleServerEndpointsAkkaServer extends App { implicit val actorSystem: ActorSystem = ActorSystem() import actorSystem.dispatcher - val bindAndCheck = Http().bindAndHandle(route, "localhost", 8080).map { _ => + val bindAndCheck = Http().newServerAt("localhost", 8080).bindFlow(route).map { _ => // testing implicit val backend: SttpBackend[Identity, Nothing, NothingT] = HttpURLConnectionBackend() diff --git a/examples/src/main/scala/sttp/tapir/examples/PartialServerLogicAkka.scala b/examples/src/main/scala/sttp/tapir/examples/PartialServerLogicAkka.scala index 2695bf22cd..1fb68f1a8f 100644 --- a/examples/src/main/scala/sttp/tapir/examples/PartialServerLogicAkka.scala +++ b/examples/src/main/scala/sttp/tapir/examples/PartialServerLogicAkka.scala @@ -61,7 +61,7 @@ object PartialServerLogicAkka extends App { val helloWorld2Route: Route = secureHelloWorld2WithLogic.toRoute // starting the server - val bindAndCheck = Http().bindAndHandle(concat(helloWorld1Route, helloWorld2Route), "localhost", 8080).map { _ => + val bindAndCheck = Http().newServerAt("localhost", 8080).bind(concat(helloWorld1Route, helloWorld2Route)).map { _ => // testing implicit val backend: SttpBackend[Identity, Nothing, NothingT] = HttpURLConnectionBackend() diff --git a/examples/src/main/scala/sttp/tapir/examples/StreamingAkkaServer.scala b/examples/src/main/scala/sttp/tapir/examples/StreamingAkkaServer.scala index c50d03d1e5..035ee9b17b 100644 --- a/examples/src/main/scala/sttp/tapir/examples/StreamingAkkaServer.scala +++ b/examples/src/main/scala/sttp/tapir/examples/StreamingAkkaServer.scala @@ -27,7 +27,7 @@ object StreamingAkkaServer extends App { implicit val actorSystem: ActorSystem = ActorSystem() import actorSystem.dispatcher - val bindAndCheck = Http().bindAndHandle(streamingRoute, "localhost", 8080).map { _ => + val bindAndCheck = Http().newServerAt("localhost", 8080).bindFlow(streamingRoute).map { _ => // testing implicit val backend: SttpBackend[Identity, Nothing, NothingT] = HttpURLConnectionBackend() val result: String = basicRequest.response(asStringAlways).get(uri"http://localhost:8080/receive").send().body diff --git a/playground/src/main/scala/sttp/tapir/example/BooksExample.scala b/playground/src/main/scala/sttp/tapir/example/BooksExample.scala index d99ff43f45..fc1e038184 100644 --- a/playground/src/main/scala/sttp/tapir/example/BooksExample.scala +++ b/playground/src/main/scala/sttp/tapir/example/BooksExample.scala @@ -105,7 +105,7 @@ object BooksExample extends App with StrictLogging { import scala.concurrent.duration._ val routes = route ~ new SwaggerAkka(yaml).routes implicit val actorSystem: ActorSystem = ActorSystem() - Await.result(Http().bindAndHandle(routes, "localhost", 8080), 1.minute) + Await.result(Http().newServerAt("localhost", 8080).bindFlow(routes), 1.minute) logger.info("Server started") } diff --git a/project/Versions.scala b/project/Versions.scala index f26870756c..9b1dc3904f 100644 --- a/project/Versions.scala +++ b/project/Versions.scala @@ -4,7 +4,7 @@ object Versions { val circe = "0.13.0" val circeYaml = "0.13.1" val sttp = "2.2.8" - val akkaHttp = "10.1.12" + val akkaHttp = "10.2.0" val akkaStreams = "2.6.9" val swaggerUi = "3.32.5" val upickle = "1.2.0" diff --git a/server/akka-http-server/src/test/scala/sttp/tapir/server/akkahttp/AkkaHttpServerTests.scala b/server/akka-http-server/src/test/scala/sttp/tapir/server/akkahttp/AkkaHttpServerTests.scala index 4806cfd9f0..3f3d0409d9 100644 --- a/server/akka-http-server/src/test/scala/sttp/tapir/server/akkahttp/AkkaHttpServerTests.scala +++ b/server/akka-http-server/src/test/scala/sttp/tapir/server/akkahttp/AkkaHttpServerTests.scala @@ -50,7 +50,7 @@ class AkkaHttpServerTests extends ServerTests[Future, AkkaStream, Route] with St } override def server(routes: NonEmptyList[Route], port: Port): Resource[IO, Unit] = { - val bind = IO.fromFuture(IO(Http().bindAndHandle(concat(routes.toList :_*), "localhost", port))) + val bind = IO.fromFuture(IO(Http().newServerAt("localhost", port).bind(concat(routes.toList :_*)))) Resource.make(bind)(binding => IO.fromFuture(IO(binding.unbind())).void).void }