fix(接口测试): 接口测试 url encoder

Closes #872
This commit is contained in:
Captain.B 2020-12-28 12:54:48 +08:00
parent 84208e1230
commit 4cc0fd0e24
1 changed files with 10 additions and 1 deletions

View File

@ -18,6 +18,8 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.ByteArrayInputStream;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
@ -154,7 +156,14 @@ public class JmeterDocumentParser {
if (!StringUtils.equals("?", u)) {
u += "&";
}
u += k + "=" + ScriptEngineUtils.calculate(v);
v = ScriptEngineUtils.calculate(v);
// urlencoder
try {
v = URLEncoder.encode(v, "UTF-8");
} catch (UnsupportedEncodingException e) {
LogUtil.error(e);
}
u += k + "=" + v;
return u;
});
ele.setTextContent(url + ((params != null && !params.equals("?")) ? params : ""));