Skinny’s HTTP Client

Skinny Framework has a quite simple and handy HTTP client library. Of course, you can use it with non-Skinny apps.


libraryDependencies += "org.skinny-framework" %% "skinny-http-client" % "2.5.2"

Simple Usage

Basically, test code will help you to learn how to use.


import skinny.http._

// GET
val response: Response = HTTP.get("")

case class Response(
  status: Int,
  headers: Map[String, String],
  headerFields: Map[String, Seq[String]],
  rawCookies: Map[String, String],
  charset: Option[String],
  body: Array[Byte]) {

  def header(name: String): Option[String] 
  def headerField(name: String): Seq[String]
  def asBytes: Array[Byte]
  def textBody: String
  def asString: String 

// GET with QueryParams

val response = HTTP.get("", "foo" -> "bar")
val response = HTTP.get(Request("").queryParams("foo" -> "bar"))
val response = HTTP.get(Request("").queryParam("foo" -> "bar").queryParam("bar" -> "baz"))

// GET with charset
val response = HTTP.get("", "UTF-8")

// Async GET

val response: scala.concurrent.Future[Response] = HTTP.asyncGet("")
val response = HTTP.asyncGet("", "foo" -> "bar")
val response = HTTP.asyncGet(Request("").queryParams("foo" -> "bar"))
val response = HTTP.asyncGet("", "UTF-8")


val response ="", "foo=bar")
val response ="", "foo" -> "bar")
val response = HTTP.postMultipart("", FormData("toResponse", TextInput("bar")))

val file = new"http-client/src/test/resources/sample.txt")
val response = HTTP.postMultipart("", FormData("toResponse", FileInput(file, "text/plain")))

val response = HTTP.asyncPost("", "foo=bar")
val response = HTTP.asyncPost("", "foo" -> "bar")
val response = HTTP.asyncPostMultipart("", FormData("toResponse", TextInput("bar")))

// PUT

val response = HTTP.put("", "foo=bar")
val response = HTTP.put("", "foo" -> "bar")
val response = HTTP.asyncPut("", "foo=bar")
val response = HTTP.asyncPut("", "foo" -> "bar")


val response = HTTP.delete("")
val response = HTTP.asyncDelete("")


val response = HTTP.trace("")
val response = HTTP.asyncTrace("")


val response = HTTP.options("")
val response = HTTP.asyncOptions("")
If you find a typo or mistake in this page, please report or fix it. How?