diff options
author | adamw <adam@warski.org> | 2017-08-30 10:52:47 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-08-30 10:52:47 +0200 |
commit | 94b9204973983b4e1620d7cdfd188ca9fd1c01ca (patch) | |
tree | e819d8a292c294d4eb316ed03323d979468fc6b6 /core/src | |
parent | f7373e2d9ad23e7b64a710222e0638d3efbdb8cf (diff) | |
download | sttp-94b9204973983b4e1620d7cdfd188ca9fd1c01ca.tar.gz sttp-94b9204973983b4e1620d7cdfd188ca9fd1c01ca.tar.bz2 sttp-94b9204973983b4e1620d7cdfd188ca9fd1c01ca.zip |
Remove copied method
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala b/core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala index 2fdce76..82d1c54 100644 --- a/core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala +++ b/core/src/main/scala/com/softwaremill/sttp/HttpURLConnectionSttpHandler.scala @@ -36,21 +36,6 @@ object HttpURLConnectionSttpHandler extends SttpHandler[Id, Nothing] { private def setBody(body: RequestBody[Nothing], c: HttpURLConnection): Unit = { if (body != NoBody) c.setDoOutput(true) - def copyStream(in: InputStream, out: OutputStream): Unit = { - val buf = new Array[Byte](1024) - - @tailrec - def doCopy(): Unit = { - val read = in.read(buf) - if (read != -1) { - out.write(buf, 0, read) - doCopy() - } - } - - doCopy() - } - body match { case NoBody => // skip @@ -68,7 +53,7 @@ object HttpURLConnectionSttpHandler extends SttpHandler[Id, Nothing] { finally channel.close() case InputStreamBody(b, _) => - copyStream(b, c.getOutputStream) + transfer(b, c.getOutputStream) case PathBody(b, _) => Files.copy(b, c.getOutputStream) |