🎨 #3586 【微信支付】修复资源上传接口使用POST请求Content-Type不正确导致签名错误的问题

This commit is contained in:
SynchPj 2025-05-14 11:54:30 +08:00 committed by GitHub
parent f5dd32de86
commit 47051bdf31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,7 +65,7 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
httpPost.releaseConnection();
}
} catch (Exception e) {
this.logError( url, requestStr, e);
this.logError(url, requestStr, e);
wxApiData.set(new WxPayApiData(url, requestStr, null, e.getMessage()));
throw new WxPayException(e.getMessage(), e);
}
@ -170,8 +170,6 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
@Override
public String postV3(String url, HttpPost httpPost) throws WxPayException {
String serialNumber = getWechatPaySerial(getConfig());
httpPost.addHeader(WECHAT_PAY_SERIAL, serialNumber);
return this.requestV3(url, httpPost);
}
@ -264,8 +262,11 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
private void configureRequest(HttpRequestBase request) {
String serialNumber = getWechatPaySerial(getConfig());
String method = request.getMethod();
request.addHeader(ACCEPT, APPLICATION_JSON);
request.addHeader(CONTENT_TYPE, APPLICATION_JSON);
if (!method.equals("POST")) {
request.addHeader(CONTENT_TYPE, APPLICATION_JSON);
}
request.addHeader(WECHAT_PAY_SERIAL, serialNumber);
request.setConfig(RequestConfig.custom()