|
@@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.commons.helpers.FormFileDataPart;
|
|
|
+import cn.com.qmth.examcloud.commons.helpers.FormFilePart;
|
|
|
import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
|
|
|
import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
|
|
|
import okhttp3.FormBody;
|
|
@@ -256,11 +256,11 @@ public class OKHttpUtil {
|
|
|
* @param url
|
|
|
* @param headers
|
|
|
* @param params
|
|
|
- * @param fileDataPartList
|
|
|
+ * @param formFilePartList
|
|
|
* @return
|
|
|
*/
|
|
|
public static Response call(HttpMethod httpMethod, String url, Map<String, String> headers,
|
|
|
- Map<String, String> params, List<FormFileDataPart> fileDataPartList) {
|
|
|
+ Map<String, String> params, List<FormFilePart> formFilePartList) {
|
|
|
|
|
|
LOG.info("[okhttp3] new call: " + httpMethod + " " + url);
|
|
|
LOG.info("[okhttp3] headers: " + JsonUtil.toJson(headers));
|
|
@@ -275,12 +275,12 @@ public class OKHttpUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(fileDataPartList)) {
|
|
|
+ if (CollectionUtils.isNotEmpty(formFilePartList)) {
|
|
|
MediaType type = MediaType.parse("application/octet-stream");
|
|
|
- for (FormFileDataPart fileDataPart : fileDataPartList) {
|
|
|
- RequestBody fileBody = RequestBody.create(type, fileDataPart.getFile());
|
|
|
- multipartBodyBuilder.addFormDataPart(fileDataPart.getParamName(),
|
|
|
- fileDataPart.getFilename(), fileBody);
|
|
|
+ for (FormFilePart part : formFilePartList) {
|
|
|
+ RequestBody fileBody = RequestBody.create(type, part.getFile());
|
|
|
+ multipartBodyBuilder.addFormDataPart(part.getParamName(),
|
|
|
+ part.getFilename(), fileBody);
|
|
|
}
|
|
|
}
|
|
|
|