diff options
author | adamw <adam@warski.org> | 2017-06-29 22:22:44 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-06-29 22:22:44 +0200 |
commit | 1ca7543ee1ddf9f10ba0bdfce2b34a9f5d713b7c (patch) | |
tree | 34c775dc535d15b1bc5af822d8980aedeba50338 /core/src/main | |
parent | 56644709f4aeb955dd30dc4a6142370cfe16838c (diff) | |
download | sttp-1ca7543ee1ddf9f10ba0bdfce2b34a9f5d713b7c.tar.gz sttp-1ca7543ee1ddf9f10ba0bdfce2b34a9f5d713b7c.tar.bz2 sttp-1ca7543ee1ddf9f10ba0bdfce2b34a9f5d713b7c.zip |
sending & receiving a stream
Diffstat (limited to 'core/src/main')
3 files changed, 13 insertions, 2 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/HttpConnectionSttpHandler.scala b/core/src/main/scala/com/softwaremill/sttp/HttpConnectionSttpHandler.scala index 8144496..82e7524 100644 --- a/core/src/main/scala/com/softwaremill/sttp/HttpConnectionSttpHandler.scala +++ b/core/src/main/scala/com/softwaremill/sttp/HttpConnectionSttpHandler.scala @@ -5,6 +5,8 @@ import java.net.HttpURLConnection import java.nio.channels.Channels import java.nio.file.Files +import com.softwaremill.sttp.model._ + import scala.annotation.tailrec import scala.io.Source diff --git a/core/src/main/scala/com/softwaremill/sttp/SttpHandler.scala b/core/src/main/scala/com/softwaremill/sttp/SttpHandler.scala index f86467b..aaab92d 100644 --- a/core/src/main/scala/com/softwaremill/sttp/SttpHandler.scala +++ b/core/src/main/scala/com/softwaremill/sttp/SttpHandler.scala @@ -1,5 +1,7 @@ package com.softwaremill.sttp +import com.softwaremill.sttp.model.{ResponseAs, ResponseAsStream} + import scala.language.higherKinds trait SttpHandler[R[_]] { @@ -7,6 +9,7 @@ trait SttpHandler[R[_]] { } trait SttpStreamHandler[R[_], S] extends SttpHandler[R] { - def send[T](request: Request, responseAsStream: ResponseAsStream[S]): R[Response[S]] - def sendStream[T](request: Request, contentType: String, stream: S, responseReader: ResponseAs[T]): R[Response[T]] + def send(request: Request, responseAsStream: ResponseAsStream[S]): R[Response[S]] + def sendStream[T](request: Request, contentType: String, stream: S, responseAs: ResponseAs[T]): R[Response[T]] + def sendStream(request: Request, contentType: String, stream: S, responseAsStream: ResponseAsStream[S]): R[Response[S]] }
\ No newline at end of file diff --git a/core/src/main/scala/com/softwaremill/sttp/package.scala b/core/src/main/scala/com/softwaremill/sttp/package.scala index 07b4df6..b007d6a 100644 --- a/core/src/main/scala/com/softwaremill/sttp/package.scala +++ b/core/src/main/scala/com/softwaremill/sttp/package.scala @@ -132,6 +132,12 @@ package object sttp { handler.sendStream(this, contentType, stream, responseAs) } + + def sendStream[R[_], S](contentType: String, stream: S, responseAs: ResponseAsStream[S])( + implicit handler: SttpStreamHandler[R, S], isRequest: IsRequest[U]): R[Response[S]] = { + + handler.sendStream(this, contentType, stream, responseAs) + } } object RequestTemplate { |