amrhassan / scala-httpc

A reasonably minimal HTTP Client for Scala

GitHub

scala-httpc

Build Status codecov Maven Central

A reasonably minimal HTTP Client for Scala built using purely functional programming and cats

Optional support for JSON payloads is available via Circe.

Quick Usage

libraryDependencies ++= Seq("io.github.amrhassan" %% "httpc" % "0.3.2")
import httpc.all._

object Sandbox extends App {

  // Description of a PUT request yielding a response
  val command = put("http://httpbin.org/put", 
      data = "OK Computer",
      headers = List(cacheControlNoCache))

  // Run the command into an Either[HttpError, Response]
  run(command) match {
    case Left(error) => println(error)
    case Right(response) =>
      println(response.status)
      println(response.text)
      println(response.json)
  }
}