perf:代码调整
This commit is contained in:
@@ -76,15 +76,16 @@ public class PlatformDingConfig {
|
||||
request = OkHttpUtil.ofPost(url, body);
|
||||
}
|
||||
request = request.newBuilder().header("x-acs-dingtalk-access-token", accessToken).build();
|
||||
try {
|
||||
Response response = OkHttpUtil.ofHttpClient().build().newCall(request).execute();
|
||||
try (Response response = OkHttpUtil.ofHttpClient().build().newCall(request).execute()) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
String rawBody = response.body().string();
|
||||
DingResponse<T> bean = JSON.parseObject(rawBody, typeReference);
|
||||
bean.setRawBody(rawBody);
|
||||
return bean;
|
||||
} else {
|
||||
LogFactory.get().info(response.body().string());
|
||||
if (response.body() != null) {
|
||||
LogFactory.get().info(response.body().string());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogFactory.get().error(e);
|
||||
|
||||
Reference in New Issue
Block a user