diff options
author | adamw <adam@warski.org> | 2018-02-08 21:03:37 +0100 |
---|---|---|
committer | adamw <adam@warski.org> | 2018-02-08 21:03:37 +0100 |
commit | 7178f4248121f06448eb6c1ead37521d94aed1e8 (patch) | |
tree | ced9e5d38aa0dd2c32cc0f53a6a369a8ad2f8482 /async-http-client-backend/fs2/src | |
parent | 0f7b6875d5efcca55e0c92940527d1e8142dc888 (diff) | |
download | sttp-7178f4248121f06448eb6c1ead37521d94aed1e8.tar.gz sttp-7178f4248121f06448eb6c1ead37521d94aed1e8.tar.bz2 sttp-7178f4248121f06448eb6c1ead37521d94aed1e8.zip |
Update fs2-reactive-streams and monix
Diffstat (limited to 'async-http-client-backend/fs2/src')
-rw-r--r-- | async-http-client-backend/fs2/src/main/scala/com/softwaremill/sttp/asynchttpclient/fs2/AsyncHttpClientFs2Backend.scala | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/async-http-client-backend/fs2/src/main/scala/com/softwaremill/sttp/asynchttpclient/fs2/AsyncHttpClientFs2Backend.scala b/async-http-client-backend/fs2/src/main/scala/com/softwaremill/sttp/asynchttpclient/fs2/AsyncHttpClientFs2Backend.scala index 8343a9b..4c6dc71 100644 --- a/async-http-client-backend/fs2/src/main/scala/com/softwaremill/sttp/asynchttpclient/fs2/AsyncHttpClientFs2Backend.scala +++ b/async-http-client-backend/fs2/src/main/scala/com/softwaremill/sttp/asynchttpclient/fs2/AsyncHttpClientFs2Backend.scala @@ -4,21 +4,10 @@ import java.nio.ByteBuffer import cats.effect._ import com.softwaremill.sttp.asynchttpclient.AsyncHttpClientBackend -import com.softwaremill.sttp.{ - FollowRedirectsBackend, - MonadAsyncError, - SttpBackend, - SttpBackendOptions, - Utf8, - concatByteBuffers -} +import com.softwaremill.sttp.{FollowRedirectsBackend, MonadAsyncError, SttpBackend, SttpBackendOptions, Utf8, concatByteBuffers} import fs2._ import fs2.interop.reactivestreams._ -import org.asynchttpclient.{ - AsyncHttpClient, - AsyncHttpClientConfig, - DefaultAsyncHttpClient -} +import org.asynchttpclient.{AsyncHttpClient, AsyncHttpClientConfig, DefaultAsyncHttpClient} import org.reactivestreams.Publisher import scala.concurrent.ExecutionContext @@ -45,7 +34,8 @@ class AsyncHttpClientFs2Backend[F[_]: Effect] private ( p: Publisher[ByteBuffer]): F[String] = { val bytes = p .toStream[F] - .runFold(ByteBuffer.allocate(0))(concatByteBuffers) + .compile + .fold(ByteBuffer.allocate(0))(concatByteBuffers) implicitly[Effect[F]].map(bytes)(bb => new String(bb.array(), Utf8)) } |