|
|
|
@@ -19,11 +19,14 @@ import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; |
|
|
|
import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder; |
|
|
|
import me.chanjar.weixin.common.util.json.WxGsonBuilder; |
|
|
|
import org.apache.http.Consts; |
|
|
|
import org.apache.http.HttpEntity; |
|
|
|
import org.apache.http.HttpHost; |
|
|
|
import org.apache.http.client.config.RequestConfig; |
|
|
|
import org.apache.http.client.methods.CloseableHttpResponse; |
|
|
|
import org.apache.http.client.methods.HttpPost; |
|
|
|
import org.apache.http.entity.ContentType; |
|
|
|
import org.apache.http.entity.StringEntity; |
|
|
|
import org.apache.http.entity.mime.MultipartEntityBuilder; |
|
|
|
import org.apache.http.impl.client.BasicResponseHandler; |
|
|
|
import org.apache.http.impl.client.CloseableHttpClient; |
|
|
|
|
|
|
|
@@ -114,10 +117,16 @@ public class TtWebServiceImpl implements TtWebService, RequestHttp<CloseableHttp |
|
|
|
httpPost.setConfig(config); |
|
|
|
} |
|
|
|
httpPost.setHeader("Content-Type","multipart/form-data"); |
|
|
|
log.info("------------"+WxGsonBuilder.create().toJson(params)); |
|
|
|
StringEntity entity = new StringEntity(WxGsonBuilder.create().toJson(params), Consts.UTF_8); |
|
|
|
entity.setContentType("application/json; charset=utf-8"); |
|
|
|
httpPost.setEntity(entity); |
|
|
|
|
|
|
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create(); |
|
|
|
builder.addTextBody("json", WxGsonBuilder.create().toJson(params), ContentType.MULTIPART_FORM_DATA); |
|
|
|
HttpEntity multipart = builder.build(); |
|
|
|
httpPost.setEntity(multipart); |
|
|
|
|
|
|
|
// log.info("------------"+WxGsonBuilder.create().toJson(params)); |
|
|
|
// StringEntity entity = new StringEntity(WxGsonBuilder.create().toJson(params), Consts.UTF_8); |
|
|
|
// entity.setContentType("application/json; charset=utf-8"); |
|
|
|
// httpPost.setEntity(entity); |
|
|
|
|
|
|
|
try (CloseableHttpResponse response = getRequestHttpClient().execute(httpPost)) { |
|
|
|
|
|
|
|
|