fix(接口测试): 修复query参数是json数据时,选择编码不生效的缺陷
--bug=1025632 --user=王孝刚 【接口测试】github#23693,接口测试不能支持query请求参数值是json格式的多参数编码 https://www.tapd.cn/55049933/s/1364721
This commit is contained in:
parent
dc1d46a116
commit
63b7057a50
|
@ -583,7 +583,7 @@ 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() ? StringUtils.join("${__urlencode(", value, ")}") : value;
|
value = keyValue.isUrlEncode() ? StringUtils.join("${__urlencode(", value.replace(",", "\\,"), ")}") : value;
|
||||||
keyValueMap.put(keyValue.getName(), value);
|
keyValueMap.put(keyValue.getName(), value);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
|
@ -618,7 +618,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
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() ? StringUtils.join("${__urlencode(", value, ")}") : value;
|
value = keyValue.isUrlEncode() ? StringUtils.join("${__urlencode(", value.replace(",", "\\,"), ")}") : 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