aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradamw <adam@warski.org>2018-03-21 19:01:02 -0400
committeradamw <adam@warski.org>2018-03-21 19:01:02 -0400
commitd06c93b7691dec9b79e36c675440cfd28e93975c (patch)
tree5aaf420c913b1f25ce66cd07be6b904de8fdc748
parent595b78eaf35673838697fe9ce8e6cf75bb2ac78b (diff)
downloadsttp-d06c93b7691dec9b79e36c675440cfd28e93975c.tar.gz
sttp-d06c93b7691dec9b79e36c675440cfd28e93975c.tar.bz2
sttp-d06c93b7691dec9b79e36c675440cfd28e93975c.zip
Updating async-http-client
-rw-r--r--async-http-client-backend/cats/src/main/scala/com/softwaremill/sttp/asynchttpclient/cats/AsyncHttpClientCatsBackend.scala4
-rw-r--r--async-http-client-backend/fs2/src/main/scala/com/softwaremill/sttp/asynchttpclient/fs2/AsyncHttpClientFs2Backend.scala5
-rw-r--r--async-http-client-backend/future/src/main/scala/com/softwaremill/sttp/asynchttpclient/future/AsyncHttpClientFutureBackend.scala4
-rw-r--r--async-http-client-backend/monix/src/main/scala/com/softwaremill/sttp/asynchttpclient/monix/AsyncHttpClientMonixBackend.scala5
-rw-r--r--async-http-client-backend/scalaz/src/main/scala/com/softwaremill/sttp/asynchttpclient/scalaz/AsyncHttpClientScalazBackend.scala4
-rw-r--r--async-http-client-backend/src/main/scala/com/softwaremill/sttp/asynchttpclient/AsyncHttpClientBackend.scala9
-rw-r--r--build.sbt2
7 files changed, 21 insertions, 12 deletions
diff --git a/async-http-client-backend/cats/src/main/scala/com/softwaremill/sttp/asynchttpclient/cats/AsyncHttpClientCatsBackend.scala b/async-http-client-backend/cats/src/main/scala/com/softwaremill/sttp/asynchttpclient/cats/AsyncHttpClientCatsBackend.scala
index 9d7ed88..506ad42 100644
--- a/async-http-client-backend/cats/src/main/scala/com/softwaremill/sttp/asynchttpclient/cats/AsyncHttpClientCatsBackend.scala
+++ b/async-http-client-backend/cats/src/main/scala/com/softwaremill/sttp/asynchttpclient/cats/AsyncHttpClientCatsBackend.scala
@@ -5,6 +5,7 @@ import java.nio.ByteBuffer
import cats.effect._
import com.softwaremill.sttp.asynchttpclient.AsyncHttpClientBackend
import com.softwaremill.sttp.{FollowRedirectsBackend, MonadAsyncError, SttpBackend, SttpBackendOptions}
+import io.netty.buffer.ByteBuf
import org.asynchttpclient.{AsyncHttpClient, AsyncHttpClientConfig, DefaultAsyncHttpClient}
import org.reactivestreams.Publisher
@@ -18,7 +19,8 @@ class AsyncHttpClientCatsBackend[F[_]: Async] private (
new AsyncMonad,
closeClient
) {
- override protected def streamBodyToPublisher(s: Nothing): Publisher[ByteBuffer] = s // nothing is everything
+ override protected def streamBodyToPublisher(s: Nothing): Publisher[ByteBuf] =
+ s // nothing is everything
override protected def publisherToStreamBody(p: Publisher[ByteBuffer]): Nothing =
throw new IllegalStateException("This backend does not support streaming")
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 a4c2391..35366c1 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
@@ -14,6 +14,7 @@ import com.softwaremill.sttp.{
}
import fs2._
import fs2.interop.reactivestreams._
+import io.netty.buffer.{ByteBuf, Unpooled}
import org.asynchttpclient.{AsyncHttpClient, AsyncHttpClientConfig, DefaultAsyncHttpClient}
import org.reactivestreams.Publisher
@@ -28,8 +29,8 @@ class AsyncHttpClientFs2Backend[F[_]: Effect] private (asyncHttpClient: AsyncHtt
closeClient
) {
- override protected def streamBodyToPublisher(s: Stream[F, ByteBuffer]): Publisher[ByteBuffer] =
- s.toUnicastPublisher
+ override protected def streamBodyToPublisher(s: Stream[F, ByteBuffer]): Publisher[ByteBuf] =
+ s.map(Unpooled.wrappedBuffer).toUnicastPublisher
override protected def publisherToStreamBody(p: Publisher[ByteBuffer]): Stream[F, ByteBuffer] =
p.toStream[F]
diff --git a/async-http-client-backend/future/src/main/scala/com/softwaremill/sttp/asynchttpclient/future/AsyncHttpClientFutureBackend.scala b/async-http-client-backend/future/src/main/scala/com/softwaremill/sttp/asynchttpclient/future/AsyncHttpClientFutureBackend.scala
index d91f404..e5f7a2c 100644
--- a/async-http-client-backend/future/src/main/scala/com/softwaremill/sttp/asynchttpclient/future/AsyncHttpClientFutureBackend.scala
+++ b/async-http-client-backend/future/src/main/scala/com/softwaremill/sttp/asynchttpclient/future/AsyncHttpClientFutureBackend.scala
@@ -4,6 +4,7 @@ import java.nio.ByteBuffer
import com.softwaremill.sttp.asynchttpclient.AsyncHttpClientBackend
import com.softwaremill.sttp.{FollowRedirectsBackend, FutureMonad, SttpBackend, SttpBackendOptions}
+import io.netty.buffer.ByteBuf
import org.asynchttpclient.{AsyncHttpClient, AsyncHttpClientConfig, DefaultAsyncHttpClient}
import org.reactivestreams.Publisher
@@ -13,7 +14,8 @@ class AsyncHttpClientFutureBackend private (asyncHttpClient: AsyncHttpClient, cl
implicit ec: ExecutionContext)
extends AsyncHttpClientBackend[Future, Nothing](asyncHttpClient, new FutureMonad, closeClient) {
- override protected def streamBodyToPublisher(s: Nothing): Publisher[ByteBuffer] = s // nothing is everything
+ override protected def streamBodyToPublisher(s: Nothing): Publisher[ByteBuf] =
+ s // nothing is everything
override protected def publisherToStreamBody(p: Publisher[ByteBuffer]): Nothing =
throw new IllegalStateException("This backend does not support streaming")
diff --git a/async-http-client-backend/monix/src/main/scala/com/softwaremill/sttp/asynchttpclient/monix/AsyncHttpClientMonixBackend.scala b/async-http-client-backend/monix/src/main/scala/com/softwaremill/sttp/asynchttpclient/monix/AsyncHttpClientMonixBackend.scala
index 3d54b26..915b325 100644
--- a/async-http-client-backend/monix/src/main/scala/com/softwaremill/sttp/asynchttpclient/monix/AsyncHttpClientMonixBackend.scala
+++ b/async-http-client-backend/monix/src/main/scala/com/softwaremill/sttp/asynchttpclient/monix/AsyncHttpClientMonixBackend.scala
@@ -11,6 +11,7 @@ import com.softwaremill.sttp.{
Utf8,
concatByteBuffers
}
+import io.netty.buffer.{ByteBuf, Unpooled}
import monix.eval.Task
import monix.execution.{Cancelable, Scheduler}
import monix.reactive.Observable
@@ -23,8 +24,8 @@ class AsyncHttpClientMonixBackend private (asyncHttpClient: AsyncHttpClient, clo
implicit scheduler: Scheduler)
extends AsyncHttpClientBackend[Task, Observable[ByteBuffer]](asyncHttpClient, TaskMonad, closeClient) {
- override protected def streamBodyToPublisher(s: Observable[ByteBuffer]): Publisher[ByteBuffer] =
- s.toReactivePublisher
+ override protected def streamBodyToPublisher(s: Observable[ByteBuffer]): Publisher[ByteBuf] =
+ s.map(Unpooled.wrappedBuffer).toReactivePublisher
override protected def publisherToStreamBody(p: Publisher[ByteBuffer]): Observable[ByteBuffer] =
Observable.fromReactivePublisher(p)
diff --git a/async-http-client-backend/scalaz/src/main/scala/com/softwaremill/sttp/asynchttpclient/scalaz/AsyncHttpClientScalazBackend.scala b/async-http-client-backend/scalaz/src/main/scala/com/softwaremill/sttp/asynchttpclient/scalaz/AsyncHttpClientScalazBackend.scala
index cdb45c3..7c2343d 100644
--- a/async-http-client-backend/scalaz/src/main/scala/com/softwaremill/sttp/asynchttpclient/scalaz/AsyncHttpClientScalazBackend.scala
+++ b/async-http-client-backend/scalaz/src/main/scala/com/softwaremill/sttp/asynchttpclient/scalaz/AsyncHttpClientScalazBackend.scala
@@ -4,6 +4,7 @@ import java.nio.ByteBuffer
import com.softwaremill.sttp.asynchttpclient.AsyncHttpClientBackend
import com.softwaremill.sttp.{FollowRedirectsBackend, MonadAsyncError, SttpBackend, SttpBackendOptions}
+import io.netty.buffer.ByteBuf
import org.asynchttpclient.{AsyncHttpClient, AsyncHttpClientConfig, DefaultAsyncHttpClient}
import org.reactivestreams.Publisher
@@ -13,7 +14,8 @@ import scalaz.{-\/, \/-}
class AsyncHttpClientScalazBackend private (asyncHttpClient: AsyncHttpClient, closeClient: Boolean)
extends AsyncHttpClientBackend[Task, Nothing](asyncHttpClient, TaskMonad, closeClient) {
- override protected def streamBodyToPublisher(s: Nothing): Publisher[ByteBuffer] = s // nothing is everything
+ override protected def streamBodyToPublisher(s: Nothing): Publisher[ByteBuf] =
+ s // nothing is everything
override protected def publisherToStreamBody(p: Publisher[ByteBuffer]): Nothing =
throw new IllegalStateException("This backend does not support streaming")
diff --git a/async-http-client-backend/src/main/scala/com/softwaremill/sttp/asynchttpclient/AsyncHttpClientBackend.scala b/async-http-client-backend/src/main/scala/com/softwaremill/sttp/asynchttpclient/AsyncHttpClientBackend.scala
index da40a18..30ae1ed 100644
--- a/async-http-client-backend/src/main/scala/com/softwaremill/sttp/asynchttpclient/AsyncHttpClientBackend.scala
+++ b/async-http-client-backend/src/main/scala/com/softwaremill/sttp/asynchttpclient/AsyncHttpClientBackend.scala
@@ -5,6 +5,8 @@ import java.nio.charset.Charset
import com.softwaremill.sttp.ResponseAs.EagerResponseHandler
import com.softwaremill.sttp._
+import io.netty.buffer.ByteBuf
+import io.netty.handler.codec.http.HttpHeaders
import org.asynchttpclient.AsyncHandler.State
import org.asynchttpclient.handler.StreamedAsyncHandler
import org.asynchttpclient.proxy.ProxyServer
@@ -16,7 +18,6 @@ import org.asynchttpclient.{
DefaultAsyncHttpClient,
DefaultAsyncHttpClientConfig,
HttpResponseBodyPart,
- HttpResponseHeaders,
HttpResponseStatus,
Param,
RequestBuilder,
@@ -56,7 +57,7 @@ abstract class AsyncHttpClientBackend[R[_], S](asyncHttpClient: AsyncHttpClient,
override def responseMonad: MonadError[R] = rm
- protected def streamBodyToPublisher(s: S): Publisher[ByteBuffer]
+ protected def streamBodyToPublisher(s: S): Publisher[ByteBuf]
protected def publisherToStreamBody(p: Publisher[ByteBuffer]): S
@@ -105,7 +106,7 @@ abstract class AsyncHttpClientBackend[R[_], S](asyncHttpClient: AsyncHttpClient,
override def onBodyPartReceived(bodyPart: HttpResponseBodyPart): AsyncHandler.State =
throw new IllegalStateException("Requested a streaming backend, unexpected eager body parts.")
- override def onHeadersReceived(headers: HttpResponseHeaders): AsyncHandler.State = {
+ override def onHeadersReceived(headers: HttpHeaders): AsyncHandler.State = {
builder.accumulate(headers)
State.CONTINUE
}
@@ -234,7 +235,7 @@ abstract class AsyncHttpClientBackend[R[_], S](asyncHttpClient: AsyncHttpClient,
response.getStatusCode,
response.getStatusText,
response.getHeaders
- .iterator()
+ .iteratorAsString()
.asScala
.map(e => (e.getKey, e.getValue))
.toList,
diff --git a/build.sbt b/build.sbt
index 4d96933..bc5c51a 100644
--- a/build.sbt
+++ b/build.sbt
@@ -90,7 +90,7 @@ lazy val asyncHttpClientBackend: Project = (project in file(
.settings(
name := "async-http-client-backend",
libraryDependencies ++= Seq(
- "org.asynchttpclient" % "async-http-client" % "2.0.38"
+ "org.asynchttpclient" % "async-http-client" % "2.4.4"
)
) dependsOn core