Skip to content
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

Update akka-http to 10.2.0 #697

Merged
merged 15 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion project/Versions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down