diff options
author | adamw <adam@warski.org> | 2017-08-31 14:40:29 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-08-31 14:40:29 +0200 |
commit | 9ec0994878856743e54c4d1a38c0c80b318d7be7 (patch) | |
tree | fb55121a0bc90325369a4c1fa8e73da9c35c37a4 /okhttp-handler/src | |
parent | 71f6a1eeee412045cc08ce8894194573362cb8f0 (diff) | |
download | sttp-9ec0994878856743e54c4d1a38c0c80b318d7be7.tar.gz sttp-9ec0994878856743e54c4d1a38c0c80b318d7be7.tar.bz2 sttp-9ec0994878856743e54c4d1a38c0c80b318d7be7.zip |
Change MonadError syntax to improve type inference
Diffstat (limited to 'okhttp-handler/src')
-rw-r--r-- | okhttp-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/okhttp-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala b/okhttp-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala index af44132..cef7054 100644 --- a/okhttp-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala +++ b/okhttp-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala @@ -89,11 +89,11 @@ abstract class OkHttpHandler[R[_], S](client: OkHttpClient) val code = res.code() val body = if (codeIsSuccess(code)) { - responseMonad.map(responseHandler(res).handle(responseAs, responseMonad), - Right(_: T)) + responseMonad.map(responseHandler(res).handle(responseAs, responseMonad))( + Right(_)) } else { - responseMonad.map(responseHandler(res).handle(asString, responseMonad), - Left(_: String)) + responseMonad.map(responseHandler(res).handle(asString, responseMonad))( + Left(_)) } val headers = res @@ -102,9 +102,7 @@ abstract class OkHttpHandler[R[_], S](client: OkHttpClient) .asScala .flatMap(name => res.headers().values(name).asScala.map((name, _))) - responseMonad.map( - body, - Response(_: Either[String, T], res.code(), headers.toList)) + responseMonad.map(body)(Response(_, res.code(), headers.toList)) } private def responseHandler(res: OkHttpResponse) = |