aboutsummaryrefslogtreecommitdiff
path: root/async-http-client-handler/scalaz/src/main
diff options
context:
space:
mode:
authoradamw <adam@warski.org>2017-07-24 16:57:51 +0200
committeradamw <adam@warski.org>2017-07-24 16:57:51 +0200
commitb1a539bd1fb5a5870c2e96c73f14e79b6caf4ff6 (patch)
tree6ef95abd69930cabb5b7566507af6dc56d25ebaf /async-http-client-handler/scalaz/src/main
parent95fee5083274bf0e856af8b868702f8965b92f1a (diff)
downloadsttp-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/src/main')
-rw-r--r--async-http-client-handler/scalaz/src/main/scala/com/softwaremill/sttp/asynchttpclient/scalaz/ScalazAsyncHttpClientHandler.scala13
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 =