From 63b7057a504e645865764994dbd4ad7e4e48ce0a Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 20 Apr 2023 14:11:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dquery=E5=8F=82=E6=95=B0=E6=98=AFjson=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=97=B6=EF=BC=8C=E9=80=89=E6=8B=A9=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1025632 --user=王孝刚 【接口测试】github#23693,接口测试不能支持query请求参数值是json格式的多参数编码 https://www.tapd.cn/55049933/s/1364721 --- .../dto/definition/request/sampler/MsHTTPSamplerProxy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java b/api-test/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java index 7d4822b687..867d489110 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java +++ b/api-test/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java @@ -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); }