Simple and concise HTTP client library for Scala

后端 未结 11 1847
梦如初夏
梦如初夏 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 20:46

    I've recently started using Dispatch, a bit arcane (great general intro, serious lack of detailed scenario/use-case based docs). Dispatch 0.9.1 is a Scala wrapper around Ning's Async Http Client; to fully understand what going on requires introducing one's self to that library. In practice, the only thing I really had to look at was the RequestBuilder - everything else falling nicely into my understanding of HTTP.

    I give the 0.9 release a solid thumbs up (so far!) on getting the job done very simply.. once you get past that initial learning curve.

    Dispatch's Http "builder" is immutable, and seems to work well in a threaded environment. Though I can't find anything in docs to state that it is thread-safe; general reading of source suggests that it is.

    Do be aware that the RequestBuilder's are mutable, and therefore are NOT thread-safe.

    Here are some additional links I've found helpful:

    • I can't find a ScalaDoc link for the 0.9.* release, so I browse the source code for the 0.9.* release;

    • ScalaDoc for the 0.8 release; a substantially different beast (today) than 0.9.

    • The "Periodic" Table of operators, also 0.8 related.

    • The older 0.8 "dispatch-classic" docs helped me understand how they used the url builders, and gave some hints on how things are tied together that did carry forward to 0.9.

提交回复
热议问题