/docs/00.md
https://github.com/eed3si9n/gigahorse · Markdown · 88 lines · 65 code · 23 blank · 0 comment · 0 complexity · d1b831c0ed2159fbd5f08797ed61377e MD5 · raw file
- ---
- out: index.html
- ---
- [AHC]: https://github.com/AsyncHttpClient/async-http-client/tree/1.9.x
- [netty]: http://netty.io
- [okhttp]: http://square.github.io/okhttp/
- [sslconfig]: https://github.com/lightbend/ssl-config
- [config]: https://github.com/lightbend/config
- [ws]: https://www.playframework.com/documentation/2.5.x/ScalaWS
- [dispatch]: https://dispatchhttp.org/Dispatch.html
- [contraband]: http://www.scala-sbt.org/contraband/
- [akkahttp]: http://doc.akka.io/docs/akka-http/current/scala.html
- [@wsargent]: https://github.com/wsargent
- [@n8han]: https://github.com/n8han
- [@Duhemm]: https://github.com/Duhemm
- [@alexdupre]: https://github.com/alexdupre
- Gigahorse
- =========
- Gigahorse is an HTTP client for Scala that can wrap either
- [Square OkHttp][okhttp], [Async Http Client][AHC], or [Akka HTTP][akkahttp] underneath.
- ### Setup
- For Square OkHttp Client:
- ```scala
- libraryDependencies += "com.eed3si9n" %% "gigahorse-okhttp" % "$gigahorse_version$"
- ```
- For Async HTTP Client:
- ```scala
- libraryDependencies += "com.eed3si9n" %% "gigahorse-asynchttpclient" % "$gigahorse_version$"
- ```
- Akka HTTP support is experimental:
- ```scala
- libraryDependencies += "com.eed3si9n" %% "gigahorse-akka-http" % "$gigahorse_version$"
- ```
- ### Dependencies
- Gigahorse-OkHttp depends on Scala and [Square OkHttp][okhttp].
- It also depends on [Lightbend SSL Config][sslconfig] and [Lightbend Config][config].
- Gigahorse-AsyncHttpClient depends on Scala, [AHC 2.0][AHC], which brings in [Netty 4][netty].
- Gigahorse-Akka-HTTP is experimental, and not all features are hooked up.
- ### Credits
- - The implementation was originally based from [The Play WS API][ws],
- including the way AHC is called and the choice of default values.
- In particular, it uses [Lightbend Config][config] and [@wsargent][@wsargent]'s [SSL Config][sslconfig],
- which uses securer defaults.
- - API design is also strongly influenced by that of [Dispatch Reboot][dispatch] by [@n8han][@n8han].
- - All datatypes are generated using [Contraband][contraband], which [@Duhemm][@Duhemm] and I worked on.
- - [@alexdupre][@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:
- ```console
- scala> import gigahorse._, support.okhttp.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()
- ```
- <div style="margin: 100px"></div>
- 