Simple and concise HTTP client library for Scala

后端 未结 11 1824
梦如初夏
梦如初夏 2020-12-12 20:26

I need a mature HTTP client library that is idiomatic to scala, concise in usage, simple semantics. I looked at the Apache HTTP and the Scala Dispatch and numerous new libra

11条回答
  •  离开以前
    2020-12-12 21:05

    I've used Dispatch, Spray Client and the Play WS Client Library...None of them were simply to use or configure. So I created a simpler HTTP Client library which lets you perform all the classic HTTP requests in simple one-liners.

    See an example:

    import cirrus.clients.BasicHTTP.GET
    
    import scala.concurrent.Await
    import scala.concurrent.duration._
    
    object MinimalExample extends App {
    
      val html = Await.result(Cirrus(GET("https://www.google.co.uk")), 3 seconds)
    
      println(html)
    }
    

    ... produces ...

    ...
    

    The library is called Cirrus and is available via Maven Central

    libraryDependencies += "com.github.godis" % "cirrus_2.11" % "1.4.1"
    

    The documentation is available on GitHub

    https://github.com/Godis/Cirrus
    

提交回复
热议问题