diff options
Diffstat (limited to 'async-http-client-handler/src')
-rw-r--r-- | async-http-client-handler/src/main/scala/com/softwaremill/sttp/asynchttpclient/AsyncHttpClientHandler.scala | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/async-http-client-handler/src/main/scala/com/softwaremill/sttp/asynchttpclient/AsyncHttpClientHandler.scala b/async-http-client-handler/src/main/scala/com/softwaremill/sttp/asynchttpclient/AsyncHttpClientHandler.scala index f89c85a..1e924a0 100644 --- a/async-http-client-handler/src/main/scala/com/softwaremill/sttp/asynchttpclient/AsyncHttpClientHandler.scala +++ b/async-http-client-handler/src/main/scala/com/softwaremill/sttp/asynchttpclient/AsyncHttpClientHandler.scala @@ -30,7 +30,8 @@ import scala.language.higherKinds abstract class AsyncHttpClientHandler[R[_], S]( asyncHttpClient: AsyncHttpClient, - rm: MonadAsyncError[R]) + rm: MonadAsyncError[R], + closeClient: Boolean) extends SttpHandler[R, S] { override def send[T](r: Request[T, S]): R[Response[T]] = { @@ -216,6 +217,11 @@ abstract class AsyncHttpClientHandler[R[_], S]( "Requested a streaming response, trying to read eagerly.")) } } + + def close(): Unit = { + if (closeClient) + asyncHttpClient.close() + } } trait MonadAsyncError[R[_]] { |