aboutsummaryrefslogtreecommitdiff
path: root/okhttp-client-handler
diff options
context:
space:
mode:
authoradamw <adam@warski.org>2017-08-30 13:33:18 +0200
committeradamw <adam@warski.org>2017-08-30 13:33:18 +0200
commit227e1d6f4433a15dfc3529bac8387540945009cf (patch)
tree7d108dec35bc99884ae1c95b0294d39f9e3c5b81 /okhttp-client-handler
parent94b9204973983b4e1620d7cdfd188ca9fd1c01ca (diff)
downloadsttp-227e1d6f4433a15dfc3529bac8387540945009cf.tar.gz
sttp-227e1d6f4433a15dfc3529bac8387540945009cf.tar.bz2
sttp-227e1d6f4433a15dfc3529bac8387540945009cf.zip
Implementing multi-part uploads for the http url connection backend
Diffstat (limited to 'okhttp-client-handler')
-rw-r--r--okhttp-client-handler/src/main/scala/com/softwaremill/sttp/okhttp/OkHttpClientHandler.scala6
1 files changed, 1 insertions, 5 deletions
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 6bef4fa..7388bb1 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
@@ -1,7 +1,6 @@
package com.softwaremill.sttp.okhttp
import java.io.IOException
-import java.net.URLEncoder
import java.nio.charset.Charset
import com.softwaremill.sttp._
@@ -77,10 +76,7 @@ abstract class OkHttpClientHandler[R[_], S](client: OkHttpClient)
private def addMultipart(builder: OkHttpMultipartBody.Builder,
mp: Multipart): Unit = {
- val disposition = s"""form-data; name="${URLEncoder.encode(mp.name, Utf8)}"""" +
- mp.fileName.fold("")(fn =>
- s"""; filename="${URLEncoder.encode(fn, Utf8)}"""")
- val allHeaders = mp.additionalHeaders + ("Content-Disposition" -> disposition)
+ val allHeaders = mp.additionalHeaders + (ContentDispositionHeader -> mp.contentDispositionHeaderValue)
val headers = Headers.of(allHeaders.asJava)
bodyToOkHttp(mp.body).foreach(builder.addPart(headers, _))