Commit 84afef48 authored by Quxl's avatar Quxl

x

parent b83cdf6a
......@@ -122,7 +122,13 @@ public class HttpUtil {
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Accept-Charset", "utf-8");
connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
if(attachments != null && attachments.size() > 0) {
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()));
if (headers != null) {
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