Gigahorse is an HTTP client for Scala with multiple backend support. For the internal backend you can choose from Apache HTTP HttpAsyncClient, Async Http Client, Square OkHttp, or Akka HTTP.
For Apache HTTP HttpAsyncClient:
libraryDependencies += "com.eed3si9n" %% "gigahorse-apache-http" % "0.7.0"
For Async HTTP Client:
libraryDependencies += "com.eed3si9n" %% "gigahorse-asynchttpclient" % "0.7.0"
For Square OkHttp 3.x Client:
libraryDependencies += "com.eed3si9n" %% "gigahorse-okhttp" % "0.7.0"
Akka HTTP support is experimental:
libraryDependencies += "com.eed3si9n" %% "gigahorse-akka-http" % "0.7.0"
Apache v2
Here’s a quick example of how to make a GET call using Gigahorse:
scala> import gigahorse._, support.apachehttp.Gigahorse
scala> import scala.concurrent._, duration._
scala> val http = Gigahorse.http(Gigahorse.config)
scala> val r = Gigahorse.url("https://api.duckduckgo.com").get.
addQueryString(
"q" -> "1 + 1"
)
scala> val f = http.run(r, Gigahorse.asString andThen {_.take(60)})
scala> Await.result(f, 120.seconds)
scala> http.close()