aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradamw <adam@warski.org>2017-08-30 13:38:27 +0200
committeradamw <adam@warski.org>2017-08-30 13:38:27 +0200
commitdc417df3abb3d775bd1cd71b23f591b9aef33533 (patch)
tree01b9ec065335e4fb70b69c10d9a04aad92da3633
parent227e1d6f4433a15dfc3529bac8387540945009cf (diff)
downloadsttp-dc417df3abb3d775bd1cd71b23f591b9aef33533.tar.gz
sttp-dc417df3abb3d775bd1cd71b23f591b9aef33533.tar.bz2
sttp-dc417df3abb3d775bd1cd71b23f591b9aef33533.zip
Rename field in request specifiction for consistency with setting response handling method
-rw-r--r--akka-http-handler/src/main/scala/com/softwaremill/sttp/akkahttp/AkkaHttpSttpHandler.scala2
-rw-r--r--async-http-client-handler/src/main/scala/com/softwaremill/sttp/asynchttpclient/AsyncHttpClientHandler.scala2
-rw-r--r--core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala4
-rw-r--r--core/src/main/scala/com/softwaremill/sttp/RequestT.scala6
-rw-r--r--okhttp-client-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala4
5 files changed, 9 insertions, 9 deletions
diff --git a/akka-http-handler/src/main/scala/com/softwaremill/sttp/akkahttp/AkkaHttpSttpHandler.scala b/akka-http-handler/src/main/scala/com/softwaremill/sttp/akkahttp/AkkaHttpSttpHandler.scala
index 4a28b2b..1759b2b 100644
--- a/akka-http-handler/src/main/scala/com/softwaremill/sttp/akkahttp/AkkaHttpSttpHandler.scala
+++ b/akka-http-handler/src/main/scala/com/softwaremill/sttp/akkahttp/AkkaHttpSttpHandler.scala
@@ -41,7 +41,7 @@ class AkkaHttpSttpHandler private (actorSystem: ActorSystem,
.flatMap(Http().singleRequest(_))
.flatMap { hr =>
val code = hr.status.intValue()
- bodyFromAkka(r.responseAs, decodeAkkaResponse(hr))
+ bodyFromAkka(r.response, decodeAkkaResponse(hr))
.map(Response(_, code, headersFromAkka(hr)))
}
}
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 b29eb97..9c4704b 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
@@ -44,7 +44,7 @@ abstract class AsyncHttpClientHandler[R[_], S](asyncHttpClient: AsyncHttpClient,
def success(r: R[Response[T]]) = cb(Right(r))
def error(t: Throwable) = cb(Left(t))
- r.responseAs match {
+ r.response match {
case ras @ ResponseAsStream() =>
preparedRequest
.execute(streamingAsyncHandler(ras, success, error))
diff --git a/core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala b/core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala
index ed95b07..c3023d8 100644
--- a/core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala
+++ b/core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala
@@ -33,12 +33,12 @@ object HttpURLConnectionSttpHandler extends SttpHandler[Id, Nothing] {
try {
val is = c.getInputStream
- readResponse(c, is, r.responseAs)
+ readResponse(c, is, r.response)
} catch {
case e: CharacterCodingException => throw e
case e: UnsupportedEncodingException => throw e
case _: IOException if c.getResponseCode != -1 =>
- readResponse(c, c.getErrorStream, r.responseAs)
+ readResponse(c, c.getErrorStream, r.response)
}
}
diff --git a/core/src/main/scala/com/softwaremill/sttp/RequestT.scala b/core/src/main/scala/com/softwaremill/sttp/RequestT.scala
index 88f64e3..8d46901 100644
--- a/core/src/main/scala/com/softwaremill/sttp/RequestT.scala
+++ b/core/src/main/scala/com/softwaremill/sttp/RequestT.scala
@@ -25,7 +25,7 @@ case class RequestT[U[_], T, +S](
uri: U[Uri],
body: RequestBody[S],
headers: Seq[(String, String)],
- responseAs: ResponseAs[T, S]
+ response: ResponseAs[T, S]
) {
def get(uri: Uri): Request[T, S] =
this.copy[Id, T, S](uri = uri, method = Method.GET)
@@ -214,10 +214,10 @@ case class RequestT[U[_], T, +S](
* consumed by the client if such a response type is requested.
*/
def response[T2, S2 >: S](ra: ResponseAs[T2, S2]): RequestT[U, T2, S2] =
- this.copy(responseAs = ra)
+ this.copy(response = ra)
def mapResponse[T2](f: T => T2): RequestT[U, T2, S] =
- this.copy(responseAs = responseAs.map(f))
+ this.copy(response = response.map(f))
def send[R[_]]()(implicit handler: SttpHandler[R, S],
isIdInRequest: IsIdInRequest[U]): R[Response[T]] = {
diff --git a/okhttp-client-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala b/okhttp-client-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala
index 7388bb1..9bc865e 100644
--- a/okhttp-client-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala
+++ b/okhttp-client-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala
@@ -123,7 +123,7 @@ class OkHttpSyncClientHandler private (client: OkHttpClient)
override def send[T](r: Request[T, Nothing]): Response[T] = {
val request = convertRequest(r)
val response = client.newCall(request).execute()
- readResponse(response, r.responseAs)
+ readResponse(response, r.response)
}
override def responseMonad: MonadError[Id] = IdMonad
@@ -152,7 +152,7 @@ abstract class OkHttpAsyncClientHandler[R[_], S](client: OkHttpClient,
error(e)
override def onResponse(call: Call, response: OkHttpResponse): Unit =
- try success(readResponse(response, r.responseAs))
+ try success(readResponse(response, r.response))
catch { case e: Exception => error(e) }
})
})