Scala-http is a project mainly written in Scala, it's free.
Simple scala wrapper around jetty http client
Simple GET request:
import http._
...
Http(
method = "GET"
,url = "http://google.com"
,onComplete = (status:Int, _, _) => println ("Google responded with "+status)
)
onComplete takes three arguments:
Let's add some extra headers:
Http(
...
,headers = Map(
"User-Agent"->"ScalaBOT 1.0"
,"Content-Type"->"application/json"
)
)
Let's include a request body:
Http(
...
,content = Some(myInputStream)
)
Http.apply (...) returns a value of Future[Either[HttpError,T]] type, where T is the type returned by your onComplete function.