diff options
author | adamw <adam@warski.org> | 2017-07-04 14:14:27 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-07-04 14:14:27 +0200 |
commit | 66eed168fa5b9868ffcee5fe1cf698148cfb5264 (patch) | |
tree | ded55762fb03c05a206d2e1cd3a9b9dedf540f95 /core/src/main | |
parent | 3aefd7447ae8f15ecd9a3401b9dd6992c4197aec (diff) | |
download | sttp-66eed168fa5b9868ffcee5fe1cf698148cfb5264.tar.gz sttp-66eed168fa5b9868ffcee5fe1cf698148cfb5264.tar.bz2 sttp-66eed168fa5b9868ffcee5fe1cf698148cfb5264.zip |
Comments
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/scala/com/softwaremill/sttp/model/package.scala | 6 | ||||
-rw-r--r-- | core/src/main/scala/com/softwaremill/sttp/package.scala | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/model/package.scala b/core/src/main/scala/com/softwaremill/sttp/model/package.scala index 24c5fa6..784b72c 100644 --- a/core/src/main/scala/com/softwaremill/sttp/model/package.scala +++ b/core/src/main/scala/com/softwaremill/sttp/model/package.scala @@ -38,6 +38,10 @@ package object model { case class FileBody(f: File) extends BasicRequestBody case class PathBody(f: Path) extends BasicRequestBody + /** + * @tparam T Target type as which the response will be read. + * @tparam S If `T` is a stream, the type of the stream. Otherwise, `Nothing`. + */ sealed trait ResponseAs[T, +S] sealed trait ResponseAsBasic[T, +S] extends ResponseAs[T, S] @@ -46,5 +50,5 @@ package object model { object ResponseAsByteArray extends ResponseAsBasic[Array[Byte], Nothing] // response as params - case class ResponseAsStream[T, S]()(implicit val x: S =:= T) extends ResponseAs[T, S] + case class ResponseAsStream[T, S]()(implicit val responseIsStream: S =:= T) extends ResponseAs[T, S] } diff --git a/core/src/main/scala/com/softwaremill/sttp/package.scala b/core/src/main/scala/com/softwaremill/sttp/package.scala index 8abea0a..8dd8c5d 100644 --- a/core/src/main/scala/com/softwaremill/sttp/package.scala +++ b/core/src/main/scala/com/softwaremill/sttp/package.scala @@ -150,8 +150,9 @@ package object sttp { * to consume it. An exception to this are streaming responses, which need to fully consumed * by the client if such a response type is requested. */ - def send[R[_], S, T, ResponseAsType[x, s] <: ResponseAs[x, s]](responseAs: ResponseAsType[T, S])( - implicit handler: SttpHandler[R, S, ResponseAsType], isRequest: IsRequest[U]): R[Response[T]] = { + def send[R[_], S, T, TypeOfResponseAs[x, s] <: ResponseAs[x, s]](responseAs: TypeOfResponseAs[T, S])( + implicit handler: SttpHandler[R, S, TypeOfResponseAs], isRequest: IsRequest[U]): R[Response[T]] = { + handler.send(this, responseAs) } } |