aboutsummaryrefslogtreecommitdiff
path: root/async-http-client-handler/monix
diff options
context:
space:
mode:
authoradamw <adam@warski.org>2017-09-04 16:27:43 +0200
committeradamw <adam@warski.org>2017-09-04 16:27:43 +0200
commit2761923dcf1ea49f7671cc2f18df9bd07f0df40b (patch)
tree1e20c4d823f0ff734d77c54e96ab738f4186c740 /async-http-client-handler/monix
parent41bbe08c125bb3714aee862ec9dc55419c29986d (diff)
downloadsttp-2761923dcf1ea49f7671cc2f18df9bd07f0df40b.tar.gz
sttp-2761923dcf1ea49f7671cc2f18df9bd07f0df40b.tar.bz2
sttp-2761923dcf1ea49f7671cc2f18df9bd07f0df40b.zip
Extracting FollowRedirectsHandler as a wrapper-handler
Diffstat (limited to 'async-http-client-handler/monix')
-rw-r--r--async-http-client-handler/monix/src/main/scala/com/softwaremill/sttp/asynchttpclient/monix/AsyncHttpClientMonixHandler.scala17
1 files changed, 12 insertions, 5 deletions
diff --git a/async-http-client-handler/monix/src/main/scala/com/softwaremill/sttp/asynchttpclient/monix/AsyncHttpClientMonixHandler.scala b/async-http-client-handler/monix/src/main/scala/com/softwaremill/sttp/asynchttpclient/monix/AsyncHttpClientMonixHandler.scala
index 786f176..311d3ea 100644
--- a/async-http-client-handler/monix/src/main/scala/com/softwaremill/sttp/asynchttpclient/monix/AsyncHttpClientMonixHandler.scala
+++ b/async-http-client-handler/monix/src/main/scala/com/softwaremill/sttp/asynchttpclient/monix/AsyncHttpClientMonixHandler.scala
@@ -3,6 +3,7 @@ package com.softwaremill.sttp.asynchttpclient.monix
import java.nio.ByteBuffer
import com.softwaremill.sttp.{
+ FollowRedirectsHandler,
MonadAsyncError,
SttpHandler,
Utf8,
@@ -50,14 +51,20 @@ class AsyncHttpClientMonixHandler private (
object AsyncHttpClientMonixHandler {
+ private def apply(asyncHttpClient: AsyncHttpClient, closeClient: Boolean)(
+ implicit scheduler: Scheduler)
+ : SttpHandler[Task, Observable[ByteBuffer]] =
+ new FollowRedirectsHandler(
+ new AsyncHttpClientMonixHandler(asyncHttpClient, closeClient))
+
/**
* @param s The scheduler used for streaming request bodies. Defaults to the
* global scheduler.
*/
def apply()(implicit s: Scheduler = Scheduler.Implicits.global)
: SttpHandler[Task, Observable[ByteBuffer]] =
- new AsyncHttpClientMonixHandler(new DefaultAsyncHttpClient(),
- closeClient = true)
+ AsyncHttpClientMonixHandler(new DefaultAsyncHttpClient(),
+ closeClient = true)
/**
* @param s The scheduler used for streaming request bodies. Defaults to the
@@ -66,8 +73,8 @@ object AsyncHttpClientMonixHandler {
def usingConfig(cfg: AsyncHttpClientConfig)(implicit s: Scheduler =
Scheduler.Implicits.global)
: SttpHandler[Task, Observable[ByteBuffer]] =
- new AsyncHttpClientMonixHandler(new DefaultAsyncHttpClient(cfg),
- closeClient = true)
+ AsyncHttpClientMonixHandler(new DefaultAsyncHttpClient(cfg),
+ closeClient = true)
/**
* @param s The scheduler used for streaming request bodies. Defaults to the
@@ -76,7 +83,7 @@ object AsyncHttpClientMonixHandler {
def usingClient(client: AsyncHttpClient)(implicit s: Scheduler =
Scheduler.Implicits.global)
: SttpHandler[Task, Observable[ByteBuffer]] =
- new AsyncHttpClientMonixHandler(client, closeClient = false)
+ AsyncHttpClientMonixHandler(client, closeClient = false)
}
private[monix] object TaskMonad extends MonadAsyncError[Task] {