aboutsummaryrefslogtreecommitdiff
path: root/async-http-client-handler/fs2/src/main
diff options
context:
space:
mode:
authorPiotr Gabara <piotr.gabara@hotmail.com>2017-08-27 20:06:52 +0200
committerPiotr Gabara <piotr.gabara@hotmail.com>2017-09-05 16:37:22 +0200
commite82346820797bb2d80d0fada7f17c5880871edce (patch)
tree1b972cfffadb9de0f6f0c99f842ada1d58662fb8 /async-http-client-handler/fs2/src/main
parentfebcdbcb4448fe1e754ecd08fb4df4bf6c6a211c (diff)
downloadsttp-e82346820797bb2d80d0fada7f17c5880871edce.tar.gz
sttp-e82346820797bb2d80d0fada7f17c5880871edce.tar.bz2
sttp-e82346820797bb2d80d0fada7f17c5880871edce.zip
Make read and connection timeout configurable
Diffstat (limited to 'async-http-client-handler/fs2/src/main')
-rw-r--r--async-http-client-handler/fs2/src/main/scala/com/softwaremill/sttp/asynchttpclient/fs2/AsyncHttpClientFs2Handler.scala9
1 files changed, 6 insertions, 3 deletions
diff --git a/async-http-client-handler/fs2/src/main/scala/com/softwaremill/sttp/asynchttpclient/fs2/AsyncHttpClientFs2Handler.scala b/async-http-client-handler/fs2/src/main/scala/com/softwaremill/sttp/asynchttpclient/fs2/AsyncHttpClientFs2Handler.scala
index 56e7b8c..8d38f43 100644
--- a/async-http-client-handler/fs2/src/main/scala/com/softwaremill/sttp/asynchttpclient/fs2/AsyncHttpClientFs2Handler.scala
+++ b/async-http-client-handler/fs2/src/main/scala/com/softwaremill/sttp/asynchttpclient/fs2/AsyncHttpClientFs2Handler.scala
@@ -21,6 +21,7 @@ import org.asynchttpclient.{
import org.reactivestreams.Publisher
import scala.concurrent.ExecutionContext
+import scala.concurrent.duration.FiniteDuration
import scala.language.higherKinds
class AsyncHttpClientFs2Handler[F[_]: Effect] private (
@@ -63,11 +64,13 @@ object AsyncHttpClientFs2Handler {
* e.g. mapping responses. Defaults to the global execution
* context.
*/
- def apply[F[_]: Effect]()(
+ def apply[F[_]: Effect](connectionTimeout: FiniteDuration = SttpHandler.DefaultConnectionTimeout)(
implicit ec: ExecutionContext = ExecutionContext.Implicits.global)
: SttpHandler[F, Stream[F, ByteBuffer]] =
- AsyncHttpClientFs2Handler[F](new DefaultAsyncHttpClient(),
- closeClient = true)
+ AsyncHttpClientFs2Handler[F](
+ new DefaultAsyncHttpClient(
+ AsyncHttpClientHandler.withConnectionTimeout(connectionTimeout)),
+ closeClient = true)
/**
* @param ec The execution context for running non-network related operations,