Skip to content

Commit c2fec4e

Browse files
committed
add post jsonbody
1 parent 0a6d678 commit c2fec4e

File tree

1 file changed

+20
-1
lines changed
  • springboot-starter/src/main/java/com/codingapi/springboot/framework/rest

1 file changed

+20
-1
lines changed

springboot-starter/src/main/java/com/codingapi/springboot/framework/rest/RestClient.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.codingapi.springboot.framework.rest;
22

3+
import com.alibaba.fastjson.JSONObject;
34
import com.codingapi.springboot.framework.rest.param.ApiGetParamBuilder;
45
import com.codingapi.springboot.framework.rest.param.ApiPostParamBuilder;
56
import com.codingapi.springboot.framework.rest.properties.RestApiProperties;
@@ -43,7 +44,25 @@ public String get(String api) {
4344
}
4445

4546
private String _post(String api, ApiPostParamBuilder paramBuilder) {
46-
return httpClient.post(api, paramBuilder.build());
47+
return _post(api, paramBuilder.build());
48+
}
49+
50+
51+
private String _post(String api, JSONObject requestBody) {
52+
return httpClient.post(api, requestBody);
53+
}
54+
55+
56+
public String post(String api, JSONObject requestBody) {
57+
for (int i=0;i< RETRY_COUNT;i++){
58+
try {
59+
return _post(api, requestBody);
60+
}catch (Exception e){
61+
log.warn("api:{},error:{}",api,e.getMessage());
62+
sleep();
63+
}
64+
}
65+
return EMPTY;
4766
}
4867

4968

0 commit comments

Comments
 (0)