Skip to content

Instantly share code, notes, and snippets.

@johanandren
Created November 18, 2015 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johanandren/482f4244e72848d0ee88 to your computer and use it in GitHub Desktop.
Save johanandren/482f4244e72848d0ee88 to your computer and use it in GitHub Desktop.
import akka.actor.ActorSystem
import akka.http.scaladsl._
import akka.http.scaladsl.model.{HttpMethods, Uri, HttpRequest}
import akka.stream.ActorMaterializer
import scala.concurrent.duration._
import scala.concurrent.Await
object Bug18797 {
def main(args: Array[String]): Unit = {
implicit val system = ActorSystem("reproducer")
implicit val mat = ActorMaterializer()
import system.dispatcher
val uri = Uri("http://www.google.com")
val done = Http(system).singleRequest(HttpRequest(method = HttpMethods.GET, uri)).flatMap { response1 =>
println("Got response 1")
Http(system).singleRequest(HttpRequest(method = HttpMethods.GET, uri)).map { response2 =>
println("Got response 2")
}
}
Await.result(done, 30.seconds)
system.shutdown()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment