Gigahorse 

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.

Setup 

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"

Dependencies 

Credits 

  • The implementation was originally based from The Play WS API, including the way AHC is called and the choice of default values. In particular, it uses Lightbend Config and @wsargent’s SSL Config, which uses securer defaults.
  • API design is also strongly influenced by that of Dispatch Reboot by @n8han.
  • All datatypes are generated using Contraband, which @Duhemm and I worked on.
  • @alexdupre contributed AHC 2.0 migration and WebSocket support.
  • Finally, props to underlying HTTP libraries for the actual HTTP work.

License 

Apache v2

Quick start 

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()

Gigahorse