有如下代码片段:
HttpGet httpGet = new HttpGet(url);
httpGet.setConfig(this.requestConfigLongTime);
CloseableHttpResponse response = null;
response = httpClient.execute(httpGet);
String data = EntityUtils.toString(response.getEntity(), "UTF-8");
if (StringUtils.isBlank(data)) {
if (hr.getStatus() == 200) {
map.put(param, (MyObject) "");
} else {
map.remove(param);
}
}
httpclient什么状况下200状态下返回的response的数据为空?
什么状况下response的数据为空且状态码不为200?
可以验证一下,到底有没有查到数据,使用postman试一试,如何也是200,没有数据,那就是你代码的问题了