fix(接口定义): 修复har文件导入选择引用环境无效的缺陷

--bug=1018879 --user=王孝刚
【接口测试】github#18808。接口自动化导入har包后,不勾选引用环境,执行时还提示要选择运行环境
https://www.tapd.cn/55049933/s/1281253
This commit is contained in:
wxg0103 2022-10-27 19:04:50 +08:00 committed by fit2-zhao
parent f1f4a64fd6
commit 993d028f4a
3 changed files with 3 additions and 1 deletions

View File

@ -32,6 +32,7 @@ public abstract class HarScenarioAbstractParser<T> extends ApiImportAbstractPars
} else {
request.setPath("/");
}
request.setUrl(harRequest.url);
parseParameters(harRequest, request);
parseRequestBody(harRequest, request.getBody());
addBodyHeader(request);

View File

@ -761,6 +761,7 @@ public class ApiScenarioService {
Boolean enable = request.getEnvironmentEnable();
String scenarioDefinition = request.getDefinition();
JSONObject element = JSONUtil.parseObject(scenarioDefinition);
ElementUtil.dataFormatting(element);
try {
Map<String, String> environmentMap = new HashMap<>();
if (BooleanUtils.isFalse(enable)) {

View File

@ -120,7 +120,7 @@ export default {
},
setDomain() {
let urlStr = this.addProtocol(this.request.url);
const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/g;
const reg = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
if (reg.test(urlStr)) {
let url = this.getURL(urlStr);
if (url && url.pathname) {