mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
5.0
This commit is contained in:
@@ -179,6 +179,10 @@ public class Client {
|
||||
private String url;
|
||||
private String method;
|
||||
private String version = DEFAULT_VERSION;
|
||||
/**
|
||||
* 回调地址
|
||||
*/
|
||||
private String notifyUrl;
|
||||
private Map<String, Object> bizContent;
|
||||
private HttpTool.HTTPMethod httpMethod;
|
||||
private Map<String, String> header;
|
||||
@@ -221,6 +225,17 @@ public class Client {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置notifyUrl
|
||||
*
|
||||
* @param notifyUrl notifyUrl
|
||||
* @return 返回RequestBuilder
|
||||
*/
|
||||
public RequestBuilder notifyUrl(String notifyUrl) {
|
||||
this.notifyUrl = notifyUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置业务参数
|
||||
*
|
||||
@@ -392,6 +407,9 @@ public class Client {
|
||||
params.put("charset", "utf-8");
|
||||
params.put("sign_type", "RSA2");
|
||||
params.put("timestamp", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
if (notifyUrl != null) {
|
||||
params.put("notify_url", notifyUrl);
|
||||
}
|
||||
if (systemParam != null) {
|
||||
params.putAll(systemParam);
|
||||
}
|
||||
|
@@ -107,6 +107,25 @@ public class AllInOneTest extends TestBase {
|
||||
client.execute(requestBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 多版本2.0
|
||||
*/
|
||||
public void testGet_v3() {
|
||||
Client.RequestBuilder requestBuilder = new Client.RequestBuilder()
|
||||
.method("story.get")
|
||||
.version("3.0")
|
||||
.notifyUrl("http://www.baidu.com")
|
||||
.bizContent(new BizContent().add("id", "2").add("name", "葫芦娃2"))
|
||||
.httpMethod(HttpTool.HTTPMethod.GET)
|
||||
.callback((requestInfo, responseData) -> {
|
||||
System.out.println(responseData);
|
||||
JSONObject jsonObject = JSON.parseObject(responseData);
|
||||
Assert.assertEquals("0", jsonObject.getString("code"));
|
||||
});
|
||||
|
||||
client.execute(requestBuilder);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试是否有权限访问,可在sop-admin中设置权限
|
||||
|
Reference in New Issue
Block a user