diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-05-12 11:11:06 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-05-12 16:01:39 +0200 |
commit | 5f81649d5f7f9eb7f620d2ac49ed4b82d8ae3991 (patch) | |
tree | 3ee600548c3131c6382cce8f5288f98d034ba926 | |
parent | d4b74ece1f2cd2140efd6368a2c0f3e1b715f562 (diff) | |
download | sonarqube-5f81649d5f7f9eb7f620d2ac49ed4b82d8ae3991.tar.gz sonarqube-5f81649d5f7f9eb7f620d2ac49ed4b82d8ae3991.zip |
SONAR-9224 HTTP data parts must have filename to allow streaming
on server side
-rw-r--r-- | sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java index 4092b1a826c..e652a21e28f 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java @@ -25,11 +25,9 @@ import java.util.Map; import javax.annotation.Nullable; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.X509TrustManager; - import okhttp3.Call; import okhttp3.Credentials; import okhttp3.FormBody; -import okhttp3.Headers; import okhttp3.HttpUrl; import okhttp3.MediaType; import okhttp3.MultipartBody; @@ -134,8 +132,9 @@ public class HttpConnector implements WsConnector { MultipartBody.Builder bodyBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); parts.entrySet().forEach(param -> { PostRequest.Part part = param.getValue(); - bodyBuilder.addPart( - Headers.of("Content-Disposition", format("form-data; name=\"%s\"", param.getKey())), + bodyBuilder.addFormDataPart( + param.getKey(), + part.getFile().getName(), RequestBody.create(MediaType.parse(part.getMediaType()), part.getFile())); }); body = bodyBuilder.build(); @@ -247,7 +246,7 @@ public class HttpConnector implements WsConnector { this.connectTimeoutMs = i; return this; } - + /** * Optional SSL socket factory with which SSL sockets will be created to establish SSL connections. * If not set, a default SSL socket factory will be used, base d on the JVM's default key store. |