fix(接口测试): 修复swagger文件导入失败的缺陷
--bug=1025299 --user=王孝刚 【接口测试】github#23524,swagger文件导入不成功 https://www.tapd.cn/55049933/s/1361285
This commit is contained in:
parent
f6ec5453f4
commit
b31bfe8aac
|
@ -428,6 +428,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
||||||
body.setFormat("JSON-SCHEMA");
|
body.setFormat("JSON-SCHEMA");
|
||||||
} else if (body.getType().equals(Body.WWW_FROM) || body.getType().equals(Body.FORM_DATA)) {
|
} else if (body.getType().equals(Body.WWW_FROM) || body.getType().equals(Body.FORM_DATA)) {
|
||||||
String parameterStr = parseSchema(bodyParameter.getSchema());
|
String parameterStr = parseSchema(bodyParameter.getSchema());
|
||||||
|
if (StringUtils.isNotBlank(parameterStr)) {
|
||||||
JSONObject jsonObject = JSONUtil.parseObject(parameterStr);
|
JSONObject jsonObject = JSONUtil.parseObject(parameterStr);
|
||||||
Set<String> strings = jsonObject.keySet();
|
Set<String> strings = jsonObject.keySet();
|
||||||
List<KeyValue> kvs = new ArrayList<>();
|
List<KeyValue> kvs = new ArrayList<>();
|
||||||
|
@ -436,6 +437,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
||||||
kvs.add(keyValue);
|
kvs.add(keyValue);
|
||||||
}
|
}
|
||||||
body.setKvs(kvs);
|
body.setKvs(kvs);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
body.setRaw(parseSchema(bodyParameter.getSchema()));
|
body.setRaw(parseSchema(bodyParameter.getSchema()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -828,7 +828,7 @@ public class MockConfigService {
|
||||||
String urlPrefix = "/mock/" + projectId + "/";
|
String urlPrefix = "/mock/" + projectId + "/";
|
||||||
String requestUri = request.getRequestURI();
|
String requestUri = request.getRequestURI();
|
||||||
String[] urlParamArr = requestUri.split(urlPrefix);
|
String[] urlParamArr = requestUri.split(urlPrefix);
|
||||||
return urlParamArr[urlParamArr.length - 1];
|
return urlParamArr.length == 0 ? "" : urlParamArr[urlParamArr.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public MockConfigResponse findByApiId(String id) {
|
public MockConfigResponse findByApiId(String id) {
|
||||||
|
|
Loading…
Reference in New Issue