pull/3/head
tanghc 4 years ago
parent 01bb3eae06
commit c6e5a20a81
  1. 6
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/validate/ApiValidator.java
  2. 9
      sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java

@ -74,13 +74,13 @@ public class ApiValidator implements Validator {
if (apiConfig.isIgnoreValidate() if (apiConfig.isIgnoreValidate()
|| BooleanUtils.toBoolean(targetRoute.getRouteDefinition().getIgnoreValidate())) { || BooleanUtils.toBoolean(targetRoute.getRouteDefinition().getIgnoreValidate())) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("忽略所有验证(ignoreValidate=true), name:{}, version:{}", param.fetchName(), param.fetchVersion()); log.debug("忽略签名校验, name:{}, version:{}", param.fetchName(), param.fetchVersion());
}
return;
} }
} else {
// 需要验证签名,先校验appKey,后校验签名,顺序不能变 // 需要验证签名,先校验appKey,后校验签名,顺序不能变
checkAppKey(param); checkAppKey(param);
checkSign(param); checkSign(param);
}
checkTimeout(param); checkTimeout(param);
checkFormat(param); checkFormat(param);
checkUploadFile(param); checkUploadFile(param);

@ -1,6 +1,7 @@
package com.gitee.sop.test; package com.gitee.sop.test;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
@ -285,9 +286,11 @@ public class AllInOneTest extends TestBase {
.bizContent(new BizContent().add("id", "1").add("name", "葫芦娃")) .bizContent(new BizContent().add("id", "1").add("name", "葫芦娃"))
.httpMethod(HttpTool.HTTPMethod.GET) .httpMethod(HttpTool.HTTPMethod.GET)
.callback((requestInfo, responseData) -> { .callback((requestInfo, responseData) -> {
int size = JSON.parseObject(responseData) int size = Optional.ofNullable(JSON.parseObject(responseData))
.getJSONObject("bigdata_get_response") .flatMap(jsonObject -> Optional.ofNullable(jsonObject.getJSONObject("bigdata_get_response")))
.getJSONArray("data").size(); .flatMap(jsonObject -> Optional.ofNullable(jsonObject.getJSONArray("data")))
.map(JSONArray::size)
.orElse(0);
Assert.assertEquals(size, 2000); Assert.assertEquals(size, 2000);
}); });

Loading…
Cancel
Save