Commit 84afef48 authored by Quxl's avatar Quxl

x

parent b83cdf6a
...@@ -122,7 +122,13 @@ public class HttpUtil { ...@@ -122,7 +122,13 @@ public class HttpUtil {
connection = (HttpURLConnection) url.openConnection(); connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST"); connection.setRequestMethod("POST");
connection.setRequestProperty("Accept-Charset", "utf-8"); connection.setRequestProperty("Accept-Charset", "utf-8");
if(attachments != null && attachments.size() > 0) {
connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY); connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
} else {
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; boundary=" + BOUNDARY);
}
connection.setRequestProperty("Content-Length", String.valueOf(data.length())); connection.setRequestProperty("Content-Length", String.valueOf(data.length()));
if (headers != null) { if (headers != null) {
for (String key : headers.keySet()) { for (String key : headers.keySet()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment