diff options
author | adamw <adam@warski.org> | 2017-07-15 12:27:30 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-07-15 12:27:30 +0200 |
commit | fd127928c0ba3eb9386a7ca9c3106c349d5baa71 (patch) | |
tree | fd5d8155c3300a3089a3d4a4b46955d2399c8b4f /core/src/main | |
parent | 462464ea1b16fedea8852e86c933738b923f96c7 (diff) | |
download | sttp-fd127928c0ba3eb9386a7ca9c3106c349d5baa71.tar.gz sttp-fd127928c0ba3eb9386a7ca9c3106c349d5baa71.tar.bz2 sttp-fd127928c0ba3eb9386a7ca9c3106c349d5baa71.zip |
Removing FileBody
Diffstat (limited to 'core/src/main')
3 files changed, 2 insertions, 11 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/HttpConnectionSttpHandler.scala b/core/src/main/scala/com/softwaremill/sttp/HttpConnectionSttpHandler.scala index 07025d5..4800a1b 100644 --- a/core/src/main/scala/com/softwaremill/sttp/HttpConnectionSttpHandler.scala +++ b/core/src/main/scala/com/softwaremill/sttp/HttpConnectionSttpHandler.scala @@ -66,9 +66,6 @@ object HttpConnectionSttpHandler extends SttpHandler[Id, Nothing] { case InputStreamBody(b) => copyStream(b, c.getOutputStream) - case FileBody(b) => - Files.copy(b.toPath, c.getOutputStream) - case PathBody(b) => Files.copy(b, c.getOutputStream) 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 0e8a5d0..982bc7c 100644 --- a/core/src/main/scala/com/softwaremill/sttp/model/package.scala +++ b/core/src/main/scala/com/softwaremill/sttp/model/package.scala @@ -37,7 +37,6 @@ package object model { case class ByteArrayBody(b: Array[Byte]) extends BasicRequestBody case class ByteBufferBody(b: ByteBuffer) extends BasicRequestBody case class InputStreamBody(b: InputStream) extends BasicRequestBody - case class FileBody(f: File) extends BasicRequestBody case class PathBody(f: Path) extends BasicRequestBody /** diff --git a/core/src/main/scala/com/softwaremill/sttp/package.scala b/core/src/main/scala/com/softwaremill/sttp/package.scala index a64908a..dc551b6 100644 --- a/core/src/main/scala/com/softwaremill/sttp/package.scala +++ b/core/src/main/scala/com/softwaremill/sttp/package.scala @@ -88,10 +88,7 @@ package object sttp { * Content type will be set to `application/octet-stream`, can be overridden later using the `contentType` method. */ def multiPart(name: String, data: File): MultiPart = - MultiPart(name, - FileBody(data), - fileName = Some(data.getName), - contentType = Some(ApplicationOctetStreamContentType)) + multiPart(name, data.toPath) /** * Content type will be set to `application/octet-stream`, can be overridden later using the `contentType` method. @@ -174,9 +171,7 @@ package object sttp { /** * If content type is not yet specified, will be set to `application/octet-stream`. */ - def body(b: File): RequestTemplate[U] = - setContentTypeIfMissing(ApplicationOctetStreamContentType).copy( - body = FileBody(b)) + def body(b: File): RequestTemplate[U] = body(b.toPath) /** * If content type is not yet specified, will be set to `application/octet-stream`. |