in aliyun-sdk-opensearch/src/main/java/com/aliyun/opensearch/util/HttpClientFactory.java [254:287]
private <T extends HttpRequestBase> HttpResult doPost(String reqURL, Map<String, String> headers,
String encoding,
T httpRequest) throws IOException {
HttpResponse response = doPostForHttpResponse(reqURL, headers, encoding, httpRequest);
String result = "";
try {
HttpEntity entity = response.getEntity();
if (null != entity) {
try {
result = getResponseContent(entity, encoding);
} finally {
HttpClientUtils.closeQuietly(response);
}
}
} catch (RuntimeException e) {
// 请求失败
this.clientTracer.fail();
throw e;
} catch (IOException e) {
// 请求失败
this.clientTracer.fail();
throw e;
}
// 请求成功
this.clientTracer.success(response, result);
StatusLine statusLine = response.getStatusLine();
List<Header> requestHeaders = Lists.newArrayList(httpRequest.getAllHeaders());
List<Header> responseHeaders = Lists.newArrayList(response.getAllHeaders());
return new HttpResult(statusLine.getStatusCode(), statusLine.getReasonPhrase(), result, httpRequest.getURI(),
requestHeaders, responseHeaders);
}