fix(接口测试): 修复query参数是json数据时,选择编码不生效的缺陷

--bug=1025632 --user=王孝刚
【接口测试】github#23693,接口测试不能支持query请求参数值是json格式的多参数编码
https://www.tapd.cn/55049933/s/1364721
This commit is contained in:
wxg0103 2023-04-20 14:11:54 +08:00 committed by fit2-zhao
parent dc1d46a116
commit 63b7057a50
1 changed files with 2 additions and 2 deletions

View File

@ -583,7 +583,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
try {
String value = keyValue.getValue() != null && keyValue.getValue().startsWith("@") ?
ScriptEngineUtils.buildFunctionCallString(keyValue.getValue()) : keyValue.getValue();
value = keyValue.isUrlEncode() ? StringUtils.join("${__urlencode(", value, ")}") : value;
value = keyValue.isUrlEncode() ? StringUtils.join("${__urlencode(", value.replace(",", "\\,"), ")}") : value;
keyValueMap.put(keyValue.getName(), value);
} catch (Exception e) {
LogUtil.error(e);
@ -618,7 +618,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
if (keyValue.getValue() != null) {
try {
String value = keyValue.getValue().startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(keyValue.getValue()) : keyValue.getValue();
value = keyValue.isUrlEncode() ? StringUtils.join("${__urlencode(", value, ")}") : value;
value = keyValue.isUrlEncode() ? StringUtils.join("${__urlencode(", value.replace(",", "\\,"), ")}") : value;
if (StringUtils.isNotEmpty(value) && value.contains(StringUtils.CR)) {
value = value.replaceAll(StringUtils.CR, StringUtils.EMPTY);
}