diff options
author | adamw <adam@warski.org> | 2017-11-22 15:44:56 +0100 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-11-22 15:44:56 +0100 |
commit | ae5876b86b8e12ee182e730c88aa690871d3fe67 (patch) | |
tree | 1284f790aa6b6af02ad475ea3fd4558d6c6ae5fe /docs/json.rst | |
parent | fe50ad485c037c30dada741cf87e552a99c2d9bb (diff) | |
download | sttp-ae5876b86b8e12ee182e730c88aa690871d3fe67.tar.gz sttp-ae5876b86b8e12ee182e730c88aa690871d3fe67.tar.bz2 sttp-ae5876b86b8e12ee182e730c88aa690871d3fe67.zip |
Docs: usage examples
Diffstat (limited to 'docs/json.rst')
-rw-r--r-- | docs/json.rst | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/docs/json.rst b/docs/json.rst index f74e086..ea8e7d2 100644 --- a/docs/json.rst +++ b/docs/json.rst @@ -20,14 +20,14 @@ This module adds a method to the request and a function that can be given to a r implicit val backend = HttpURLConnectionBackend() // Assume that there is an implicit circe encoder in scope - // for the request Payload, and a decoder for the Response + // for the request Payload, and a decoder for the MyResponse val requestPayload: Payload = ??? - val response: Either[io.circe.Error, Response] = + val response: Either[io.circe.Error, MyResponse] = sttp .post(uri"...") .body(requestPayload) - .response(asJson[Response]) + .response(asJson[MyResponse]) .send() Json4s @@ -47,12 +47,14 @@ Usage example:: implicit val backend = HttpURLConnectionBackend() case class Payload(...) + case class MyResponse(...) + val requestPayload: Payload = Payload(...) - val response: Response[Payload] = + val response: Response[MyResponse] = sttp .post(uri"...") .body(requestPayload) - .response(asJson[Response]) + .response(asJson[MyResponse]) .send() |