fix(接口测试): 修复正则提取模版问题
--bug=1037331 --user=赵勇 【接口测试】定义-调试-后置-快速提取中正则匹配结果模式不一样但结果相同 https://www.tapd.cn/55049933/s/1477611
This commit is contained in:
parent
8cfa6c3499
commit
b210957535
|
@ -36,8 +36,8 @@ public class RegexExtractConverter extends ExtractConverter<RegexExtract> {
|
|||
private String getTemplate(String expressionMatchingRule) {
|
||||
// $1$提取 JSON 响应中的第一个匹配项 $0$用于提取整个 JSON 响应
|
||||
HashMap<String, String> ruleValueMap = new HashMap<>() {{
|
||||
put(RegexExtract.ExpressionRuleType.EXPRESSION.name(), "$1$");
|
||||
put(RegexExtract.ExpressionRuleType.GROUP.name(), "$0$");
|
||||
put(RegexExtract.ExpressionRuleType.EXPRESSION.name(), "$0$");
|
||||
put(RegexExtract.ExpressionRuleType.GROUP.name(), "$1$");
|
||||
}};
|
||||
if (StringUtils.isBlank(expressionMatchingRule)) {
|
||||
return ruleValueMap.get(RegexExtract.ExpressionRuleType.EXPRESSION.name());
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<template>
|
||||
<MsDrawer
|
||||
v-model:visible="innerVisible"
|
||||
:width="680"
|
||||
:width="720"
|
||||
:show-full-screen="true"
|
||||
:title="t('apiTestDebug.fastExtraction')"
|
||||
disabled-width-drag
|
||||
@confirm="emit('apply', expressionForm)"
|
||||
|
@ -234,7 +235,7 @@
|
|||
if (matchesIterator) {
|
||||
const matches = Array.from(matchesIterator);
|
||||
try {
|
||||
if (expressionForm.value.expressionMatchingRule === 'expression') {
|
||||
if (expressionForm.value.expressionMatchingRule === 'EXPRESSION') {
|
||||
// 匹配表达式,取第一个匹配结果,是完整匹配结果
|
||||
matchResult.value = matches.map((e) => e[0]) || [];
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue