@@ -105,8 +105,8 @@ public String postV3(String url, String requestStr) throws WxPayException {
105
105
}
106
106
107
107
private String requestV3 (String url , String requestStr , HttpRequestBase httpRequestBase ) throws WxPayException {
108
- try ( CloseableHttpClient httpClient = this .createApiV3HttpClient ();
109
- CloseableHttpResponse response = httpClient .execute (httpRequestBase )) {
108
+ CloseableHttpClient httpClient = this .createApiV3HttpClient ();
109
+ try ( CloseableHttpResponse response = httpClient .execute (httpRequestBase )) {
110
110
//v3已经改为通过状态码判断200 204 成功
111
111
int statusCode = response .getStatusLine ().getStatusCode ();
112
112
//post方法有可能会没有返回值的情况
@@ -142,8 +142,8 @@ public String patchV3(String url, String requestStr) throws WxPayException {
142
142
public String postV3WithWechatpaySerial (String url , String requestStr ) throws WxPayException {
143
143
HttpPost httpPost = this .createHttpPost (url , requestStr );
144
144
this .configureRequest (httpPost );
145
- try ( CloseableHttpClient httpClient = this .createApiV3HttpClient ();
146
- CloseableHttpResponse response = httpClient .execute (httpPost )) {
145
+ CloseableHttpClient httpClient = this .createApiV3HttpClient ();
146
+ try ( CloseableHttpResponse response = httpClient .execute (httpPost )) {
147
147
//v3已经改为通过状态码判断200 204 成功
148
148
int statusCode = response .getStatusLine ().getStatusCode ();
149
149
String responseString = "{}" ;
@@ -178,9 +178,8 @@ public String postV3(String url, HttpPost httpPost) throws WxPayException {
178
178
@ Override
179
179
public String requestV3 (String url , HttpRequestBase httpRequest ) throws WxPayException {
180
180
this .configureRequest (httpRequest );
181
-
182
- try (CloseableHttpClient httpClient = this .createApiV3HttpClient ();
183
- CloseableHttpResponse response = httpClient .execute (httpRequest )) {
181
+ CloseableHttpClient httpClient = this .createApiV3HttpClient ();
182
+ try (CloseableHttpResponse response = httpClient .execute (httpRequest )) {
184
183
//v3已经改为通过状态码判断200 204 成功
185
184
int statusCode = response .getStatusLine ().getStatusCode ();
186
185
//post方法有可能会没有返回值的情况
@@ -223,11 +222,9 @@ public String getV3WithWechatPaySerial(String url) throws WxPayException {
223
222
@ Override
224
223
public InputStream downloadV3 (String url ) throws WxPayException {
225
224
HttpGet httpGet = new WxPayV3DownloadHttpGet (url );
226
- httpGet .addHeader (ACCEPT , ContentType .WILDCARD .getMimeType ());
227
- String serialNumber = getWechatPaySerial (getConfig ());
228
- httpGet .addHeader (WECHAT_PAY_SERIAL , serialNumber );
229
- try (CloseableHttpClient httpClient = this .createApiV3HttpClient ();
230
- CloseableHttpResponse response = httpClient .execute (httpGet )) {
225
+ this .configureRequest (httpGet );
226
+ CloseableHttpClient httpClient = this .createApiV3HttpClient ();
227
+ try (CloseableHttpResponse response = httpClient .execute (httpGet )) {
231
228
//v3已经改为通过状态码判断200 204 成功
232
229
int statusCode = response .getStatusLine ().getStatusCode ();
233
230
Header contentType = response .getFirstHeader (HttpHeaders .CONTENT_TYPE );
0 commit comments