eureka
tanghc 4 years ago
parent 1ef78cf582
commit 0e20e75752
  1. 15
      sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/BaseRequest.java
  2. 2
      sop-sdk/sdk-java/src/test/java/com/gitee/sop/sdk/SdkTest.java

@ -44,6 +44,8 @@ public abstract class BaseRequest<T extends BaseResponse> {
private String bizContent = EMPTY_JSON; private String bizContent = EMPTY_JSON;
private Object bizModel; private Object bizModel;
private RequestMethod requestMethod = RequestMethod.POST;
/** /**
* 上传文件 * 上传文件
*/ */
@ -144,13 +146,12 @@ public abstract class BaseRequest<T extends BaseResponse> {
return responseClass; return responseClass;
} }
/**
* 指定HTTP请求method,默认POST public RequestMethod getRequestMethod() {
* return requestMethod;
* @return
*/
protected RequestMethod getRequestMethod() {
return RequestMethod.POST;
} }
public void setRequestMethod(RequestMethod requestMethod) {
this.requestMethod = requestMethod;
}
} }

@ -3,6 +3,7 @@ package com.gitee.sop.sdk;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gitee.sop.sdk.client.OpenClient; import com.gitee.sop.sdk.client.OpenClient;
import com.gitee.sop.sdk.common.RequestMethod;
import com.gitee.sop.sdk.common.UploadFile; import com.gitee.sop.sdk.common.UploadFile;
import com.gitee.sop.sdk.model.DemoFileUploadModel; import com.gitee.sop.sdk.model.DemoFileUploadModel;
import com.gitee.sop.sdk.model.GetStoryModel; import com.gitee.sop.sdk.model.GetStoryModel;
@ -65,6 +66,7 @@ public class SdkTest extends TestCase {
Map<String, Object> bizModel = new HashMap<>(); Map<String, Object> bizModel = new HashMap<>();
bizModel.put("name", "白雪公主"); bizModel.put("name", "白雪公主");
request.setBizModel(bizModel); request.setBizModel(bizModel);
// request.setRequestMethod(RequestMethod.GET);
// 发送请求 // 发送请求
CommonResponse response = client.execute(request); CommonResponse response = client.execute(request);

Loading…
Cancel
Save