diff options
author | adamw <adam@warski.org> | 2017-07-24 16:57:51 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-07-24 16:57:51 +0200 |
commit | b1a539bd1fb5a5870c2e96c73f14e79b6caf4ff6 (patch) | |
tree | 6ef95abd69930cabb5b7566507af6dc56d25ebaf /async-http-client-handler/scalaz | |
parent | 95fee5083274bf0e856af8b868702f8965b92f1a (diff) | |
download | sttp-b1a539bd1fb5a5870c2e96c73f14e79b6caf4ff6.tar.gz sttp-b1a539bd1fb5a5870c2e96c73f14e79b6caf4ff6.tar.bz2 sttp-b1a539bd1fb5a5870c2e96c73f14e79b6caf4ff6.zip |
Adding streaming to the monix async http client handler
Diffstat (limited to 'async-http-client-handler/scalaz')
-rw-r--r-- | async-http-client-handler/scalaz/src/main/scala/com/softwaremill/sttp/asynchttpclient/scalaz/ScalazAsyncHttpClientHandler.scala | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/async-http-client-handler/scalaz/src/main/scala/com/softwaremill/sttp/asynchttpclient/scalaz/ScalazAsyncHttpClientHandler.scala b/async-http-client-handler/scalaz/src/main/scala/com/softwaremill/sttp/asynchttpclient/scalaz/ScalazAsyncHttpClientHandler.scala index cb3bdef..0460fff 100644 --- a/async-http-client-handler/scalaz/src/main/scala/com/softwaremill/sttp/asynchttpclient/scalaz/ScalazAsyncHttpClientHandler.scala +++ b/async-http-client-handler/scalaz/src/main/scala/com/softwaremill/sttp/asynchttpclient/scalaz/ScalazAsyncHttpClientHandler.scala @@ -1,5 +1,7 @@ package com.softwaremill.sttp.asynchttpclient.scalaz +import java.nio.ByteBuffer + import com.softwaremill.sttp.asynchttpclient.{ AsyncHttpClientHandler, MonadAsyncError @@ -9,12 +11,21 @@ import org.asynchttpclient.{ AsyncHttpClientConfig, DefaultAsyncHttpClient } +import org.reactivestreams.Publisher import scalaz.{-\/, \/-} import scalaz.concurrent.Task class ScalazAsyncHttpClientHandler private (asyncHttpClient: AsyncHttpClient) - extends AsyncHttpClientHandler[Task](asyncHttpClient, TaskMonad) + extends AsyncHttpClientHandler[Task, Nothing](asyncHttpClient, TaskMonad) { + + override protected def streamBodyToPublisher( + s: Nothing): Publisher[ByteBuffer] = s // nothing is everything + + override protected def publisherToStreamBody( + p: Publisher[ByteBuffer]): Nothing = + throw new IllegalStateException("This handler does not support streaming") +} object ScalazAsyncHttpClientHandler { def apply(): ScalazAsyncHttpClientHandler = |