fix(接口测试): 参数提取过滤默认空行

This commit is contained in:
baiqi 2024-10-30 11:15:37 +08:00 committed by Craftsman
parent 1ad3fa9186
commit 8f359f95d7
2 changed files with 10 additions and 23 deletions

View File

@ -512,17 +512,14 @@
} from '@/models/apiTest/common';
import { ParamsRequestType } from '@/models/projectManagement/commonScript';
import { DataSourceItem } from '@/models/projectManagement/environmental';
import {
RequestConditionProcessor,
RequestExtractEnvType,
RequestExtractExpressionEnum,
RequestExtractExpressionRuleType,
RequestExtractResultMatchingRule,
RequestExtractScope,
ResponseBodyXPathAssertionFormat,
} from '@/enums/apiEnum';
import { RequestConditionProcessor, RequestExtractExpressionEnum, RequestExtractScope } from '@/enums/apiEnum';
import { defaultKeyValueParamItem, extractTypeOptions, scriptExampleMap } from '@/views/api-test/components/config';
import {
defaultExtractParamItem,
defaultKeyValueParamItem,
extractTypeOptions,
scriptExampleMap,
} from '@/views/api-test/components/config';
const { openModal } = useModal();
@ -902,19 +899,6 @@
}
const extractParamsTableRef = ref<InstanceType<typeof paramTable>>();
const defaultExtractParamItem: ExpressionConfig = {
enable: true,
variableName: '',
variableType: RequestExtractEnvType.TEMPORARY,
extractScope: RequestExtractScope.BODY,
expression: '',
extractType: RequestExtractExpressionEnum.JSON_PATH,
expressionMatchingRule: RequestExtractExpressionRuleType.EXPRESSION,
resultMatchingRule: RequestExtractResultMatchingRule.RANDOM,
resultMatchingRuleNum: 1,
responseFormat: ResponseBodyXPathAssertionFormat.XML,
moreSettingPopoverVisible: false,
};
const fastExtractionVisible = ref(false);
const activeRecord = ref({ ...defaultExtractParamItem }); //

View File

@ -539,6 +539,7 @@
casePriorityOptions,
caseStatusOptions,
defaultBodyParamsItem,
defaultExtractParamItem,
defaultHeaderParamsItem,
defaultKeyValueParamItem,
defaultRequestParamsItem,
@ -1009,6 +1010,8 @@
processor.extractParams || [],
defaultKeyValueParamItem
).validParams;
} else if (processor.processorType === RequestConditionProcessor.EXTRACT) {
processor.extractors = filterKeyValParams(processor.extractors || [], defaultExtractParamItem).validParams;
}
return processor;
});