fix(接口测试): 修复接口ms文件导入格式错误问题

https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001018235
--user=郭雨琦
This commit is contained in:
guoyuqi 2022-10-17 18:34:16 +08:00 committed by xiaomeinvG
parent 617f3979f3
commit 911e49fb8e
1 changed files with 4 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import io.metersphere.api.dto.automation.ReferenceDTO;
import io.metersphere.api.dto.automation.TcpTreeTableDataStruct;
import io.metersphere.api.dto.datacount.ApiDataCountResult;
import io.metersphere.api.dto.definition.*;
import io.metersphere.api.dto.definition.request.ElementUtil;
import io.metersphere.api.dto.definition.request.assertions.document.DocumentElement;
import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy;
import io.metersphere.api.dto.definition.request.sampler.MsJDBCSampler;
@ -1442,7 +1443,9 @@ public class ApiDefinitionService {
private boolean setImportHashTree(ApiDefinitionWithBLOBs apiDefinition) {
String request = apiDefinition.getRequest();
MsHTTPSamplerProxy msHTTPSamplerProxy = JSONUtil.parseObject(request, MsHTTPSamplerProxy.class);
JSONObject jsonObject = JSONUtil.parseObject(request);
ElementUtil.dataFormatting(jsonObject);
MsHTTPSamplerProxy msHTTPSamplerProxy = JSONUtil.parseObject(jsonObject.toString(), MsHTTPSamplerProxy.class);
boolean createCase = CollectionUtils.isNotEmpty(msHTTPSamplerProxy.getHeaders());
if (CollectionUtils.isNotEmpty(msHTTPSamplerProxy.getArguments()) && !createCase) {
createCase = true;