Created
June 19, 2016 16:35
-
-
Save takezoe/b758434f6816f56aab4d9d00489826ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.model._ | |
import akka.http.scaladsl.unmarshalling.Unmarshal | |
import akka.stream.ActorMaterializer | |
import scala.concurrent.ExecutionContext.Implicits.global | |
object AkkaHttpSample extends App { | |
implicit val system = ActorSystem() | |
implicit val materializer = ActorMaterializer() | |
val f = Http().singleRequest(HttpRequest(uri = "https://jp.stanby.com/")) | |
f.foreach { res => | |
Unmarshal(res.entity).to[String].foreach { s => | |
println(s) | |
system.terminate() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment