fix(接口测试): 修复场景导入postman请求缺失url路径的缺陷

--bug=1033565 --user=王孝刚 【接口测试】github#27921,接口场景导入postman缺失url路径 https://www.tapd.cn/55049933/s/1444766
This commit is contained in:
wxg0103 2023-12-18 14:54:18 +08:00 committed by 刘瑞斌
parent 2e529d07f4
commit 28c81eae67
1 changed files with 2 additions and 2 deletions

View File

@ -7,14 +7,13 @@ import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy;
import io.metersphere.api.dto.definition.response.HttpResponse; import io.metersphere.api.dto.definition.response.HttpResponse;
import io.metersphere.api.dto.scenario.Body; import io.metersphere.api.dto.scenario.Body;
import io.metersphere.api.dto.scenario.KeyValue; import io.metersphere.api.dto.scenario.KeyValue;
import io.metersphere.commons.constants.RequestTypeConstants;
import io.metersphere.base.domain.ApiDefinitionWithBLOBs; import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
import io.metersphere.base.domain.ApiScenarioWithBLOBs; import io.metersphere.base.domain.ApiScenarioWithBLOBs;
import io.metersphere.commons.constants.RequestTypeConstants;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.JSON; import io.metersphere.commons.utils.JSON;
import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.commons.utils.JSONUtil;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -153,6 +152,7 @@ public abstract class ApiImportAbstractParser<T> implements ApiImportParser<T> {
// 路径去掉域名/IP 地址保留方法名称及参数 // 路径去掉域名/IP 地址保留方法名称及参数
request.setPath(formatPath(path)); request.setPath(formatPath(path));
request.setMethod(method); request.setMethod(method);
request.setUrl(path);
request.setProtocol(RequestTypeConstants.HTTP); request.setProtocol(RequestTypeConstants.HTTP);
request.setId(UUID.randomUUID().toString()); request.setId(UUID.randomUUID().toString());
request.setHeaders(new ArrayList<>()); request.setHeaders(new ArrayList<>());