回调Http状态码异常时,记录响应消息;

v1.8.2
xuxueli 7 years ago
parent 7b052d7331
commit 5c0b206f33

@ -95,12 +95,13 @@ public class AdminApiUtil {
HttpResponse response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
if (null != entity) {
String responseMsg = EntityUtils.toString(entity, "UTF-8");
if (response.getStatusLine().getStatusCode() != 200) {
EntityUtils.consume(entity);
return new ReturnT<String>(response.getStatusLine().getStatusCode(), "StatusCode Error.");
return new ReturnT<String>(response.getStatusLine().getStatusCode(),
"StatusCode+"+ response.getStatusLine().getStatusCode() +" Errorresponse" + responseMsg);
}
String responseMsg = EntityUtils.toString(entity, "UTF-8");
EntityUtils.consume(entity);
if (responseMsg!=null && responseMsg.startsWith("{")) {
ReturnT<String> result = JacksonUtil.readValue(responseMsg, ReturnT.class);

Loading…
Cancel
Save