fix(接口测试): 修复接口定义导入metersphere格式失败的缺陷

--bug=1013014 --user=王孝刚 【接口测试】导入接口文件-格式为metersphere-导入提示格式错误-导入失败
https://www.tapd.cn/55049933/s/1153505
This commit is contained in:
wxg0103 2022-05-06 16:20:09 +08:00 committed by halo-ci-bot[bot]
parent fb50ed2a29
commit 1eaa4a53a7
2 changed files with 3 additions and 3 deletions

View File

@ -31,7 +31,7 @@ public class MsDefinitionParser extends MsAbstractParser<ApiDefinitionImport> {
@Override
public ApiDefinitionImport parse(InputStream source, ApiTestImportRequest request) {
String testStr = getApiTestStr(source);
JSONObject testObject = JSONObject.parseObject(testStr, Feature.OrderedField);
JSONObject testObject = JSONObject.parseObject(testStr, Feature.DisableSpecialKeyDetect);
this.projectId = request.getProjectId();
if (StringUtils.isNotBlank(request.getModuleId())) {
this.selectModule = ApiDefinitionImportUtil.getSelectModule(request.getModuleId());

View File

@ -993,7 +993,7 @@ public class ApiDefinitionService {
private String setImportHashTree(ApiDefinitionWithBLOBs apiDefinition) {
String request = apiDefinition.getRequest();
MsHTTPSamplerProxy msHTTPSamplerProxy = JSONObject.parseObject(request, MsHTTPSamplerProxy.class);
MsHTTPSamplerProxy msHTTPSamplerProxy = JSONObject.parseObject(request, MsHTTPSamplerProxy.class, Feature.DisableSpecialKeyDetect);
msHTTPSamplerProxy.setId(apiDefinition.getId());
msHTTPSamplerProxy.setHashTree(new LinkedList<>());
apiDefinition.setRequest(JSONObject.toJSONString(msHTTPSamplerProxy));
@ -1002,7 +1002,7 @@ public class ApiDefinitionService {
private String setImportTCPHashTree(ApiDefinitionWithBLOBs apiDefinition) {
String request = apiDefinition.getRequest();
MsTCPSampler tcpSampler = JSONObject.parseObject(request, MsTCPSampler.class);
MsTCPSampler tcpSampler = JSONObject.parseObject(request, MsTCPSampler.class, Feature.DisableSpecialKeyDetect);
tcpSampler.setId(apiDefinition.getId());
tcpSampler.setHashTree(new LinkedList<>());
apiDefinition.setRequest(JSONObject.toJSONString(tcpSampler));