fix(接口测试): 修复参数名编码不生效的缺陷
--bug=1020647 --user=王孝刚 【接口测试】请求参数-参数名编码没生效 https://www.tapd.cn/55049933/s/1314352
This commit is contained in:
parent
67b10f5277
commit
047c1b6579
|
@ -554,8 +554,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
try {
|
try {
|
||||||
String value = keyValue.getValue() != null && keyValue.getValue().startsWith("@") ?
|
String value = keyValue.getValue() != null && keyValue.getValue().startsWith("@") ?
|
||||||
ScriptEngineUtils.buildFunctionCallString(keyValue.getValue()) : keyValue.getValue();
|
ScriptEngineUtils.buildFunctionCallString(keyValue.getValue()) : keyValue.getValue();
|
||||||
value = keyValue.isUrlEncode() ? "${__urlencode(" + value + ")}" : value;
|
value = keyValue.isUrlEncode() ? StringUtils.join(StringUtils.join("${__urlencode(", value), ")}") : value;
|
||||||
keyValueMap.put(keyValue.getName(), value);
|
String key = keyValue.isUrlEncode() ? StringUtils.join(StringUtils.join("${__urlencode(", keyValue.getName()), ")}") : keyValue.getName();
|
||||||
|
keyValueMap.put(key, value);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
|
@ -585,11 +586,11 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
stringBuffer.append("?");
|
stringBuffer.append("?");
|
||||||
}
|
}
|
||||||
this.getArguments().stream().filter(KeyValue::isEnable).filter(KeyValue::isValid).forEach(keyValue -> {
|
this.getArguments().stream().filter(KeyValue::isEnable).filter(KeyValue::isValid).forEach(keyValue -> {
|
||||||
stringBuffer.append(keyValue.getName());
|
stringBuffer.append(keyValue.isUrlEncode() ? StringUtils.join(StringUtils.join("${__urlencode(", keyValue.getName()), ")}") : keyValue.getName());
|
||||||
if (keyValue.getValue() != null) {
|
if (keyValue.getValue() != null) {
|
||||||
try {
|
try {
|
||||||
String value = keyValue.getValue().startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(keyValue.getValue()) : keyValue.getValue();
|
String value = keyValue.getValue().startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(keyValue.getValue()) : keyValue.getValue();
|
||||||
value = keyValue.isUrlEncode() ? "${__urlencode(" + value + ")}" : value;
|
value = keyValue.isUrlEncode() ? StringUtils.join(StringUtils.join("${__urlencode(", value), ")}") : value;
|
||||||
if (StringUtils.isNotEmpty(value) && value.contains(StringUtils.CR)) {
|
if (StringUtils.isNotEmpty(value) && value.contains(StringUtils.CR)) {
|
||||||
value = value.replaceAll(StringUtils.CR, StringUtils.EMPTY);
|
value = value.replaceAll(StringUtils.CR, StringUtils.EMPTY);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue