From 7178f4248121f06448eb6c1ead37521d94aed1e8 Mon Sep 17 00:00:00 2001 From: adamw Date: Thu, 8 Feb 2018 21:03:37 +0100 Subject: Update fs2-reactive-streams and monix --- .../fs2/AsyncHttpClientFs2Backend.scala | 18 ++++-------------- build.sbt | 8 ++++---- .../streaming/AsyncHttpClientFs2StreamingTests.scala | 3 ++- 3 files changed, 10 insertions(+), 19 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)) } diff --git a/build.sbt b/build.sbt index 64f54d7..497bcfb 100644 --- a/build.sbt +++ b/build.sbt @@ -36,12 +36,12 @@ val commonSettings = Seq( val akkaHttpVersion = "10.0.11" val akkaHttp = "com.typesafe.akka" %% "akka-http" % akkaHttpVersion -val monixVersion = "2.3.2" +val monixVersion = "2.3.3" val monix = "io.monix" %% "monix" % monixVersion val circeVersion = "0.9.1" -val scalaTest = "org.scalatest" %% "scalatest" % "3.0.4" +val scalaTest = "org.scalatest" %% "scalatest" % "3.0.5" lazy val rootProject = (project in file(".")) .settings(commonSettings: _*) @@ -104,7 +104,7 @@ lazy val asyncHttpClientScalazBackend: Project = (project in file( .settings( name := "async-http-client-backend-scalaz", libraryDependencies ++= Seq( - "org.scalaz" %% "scalaz-concurrent" % "7.2.18" + "org.scalaz" %% "scalaz-concurrent" % "7.2.19" ) ) dependsOn asyncHttpClientBackend @@ -132,7 +132,7 @@ lazy val asyncHttpClientFs2Backend: Project = (project in file( .settings( name := "async-http-client-backend-fs2", libraryDependencies ++= Seq( - "com.github.zainab-ali" %% "fs2-reactive-streams" % "0.2.7" + "com.github.zainab-ali" %% "fs2-reactive-streams" % "0.5.0" ) ) dependsOn asyncHttpClientBackend diff --git a/tests/src/test/scala/com/softwaremill/sttp/streaming/AsyncHttpClientFs2StreamingTests.scala b/tests/src/test/scala/com/softwaremill/sttp/streaming/AsyncHttpClientFs2StreamingTests.scala index 735a5c3..ec6ce05 100644 --- a/tests/src/test/scala/com/softwaremill/sttp/streaming/AsyncHttpClientFs2StreamingTests.scala +++ b/tests/src/test/scala/com/softwaremill/sttp/streaming/AsyncHttpClientFs2StreamingTests.scala @@ -24,6 +24,7 @@ class AsyncHttpClientFs2StreamingTests stream .map(bb => Chunk.array(bb.array)) .through(text.utf8DecodeC) - .runFoldMonoid + .compile + .foldMonoid } -- cgit v1.2.3