%40未在Jmeter中解码为@ [英] %40 is not getting decoded to @ in Jmeter
问题描述
我正在尝试Jmeter工具进行负载测试,其中我通过一个csv文件提供数据,其中包含所有电子邮件和密码登录请求。但是当传递参数时,Jmeter正在用'%40'编码'@'符号,如果我在我的csv中放置%40代替@,它在Jmeter中不会解码为@。对于其他特殊字符,编码和解码正常。请帮助。
I'm trying Jmeter tool for load testing where i'm feeding the data through a csv file which has all the emails and passwords for login request. But while passing the parameter, Jmeter is encoding '@' sign with '%40' and if i put %40 in place of @ in my csv, its not getting decoded to @ in Jmeter. For other special characters, the encoding and decoding is happening properly. Please help.
推荐答案
这应该是完全预期的。
It should be totally expected.
如果您通过GET请求登录%40
是正确的编码方式 @
符号。
If you're logging in via GET request %40
is correct way of encoding @
symbol.
如果您要发送POST请求,JMeter应自动发送 @
符号(至少我的JMeter 2.10 )
If you're sending a POST request, JMeter should automatically send @
symbol (at least my JMeter 2.10 does)
您可能希望尝试以下方法之一:
You might wish to try one of following:
- 添加查看结果树监听器,切换到
HTTP $ c $
确认 - 明确告知JMeter通过 __urldecode()函数解码电子邮件
-
使用 Beanshell预处理器正确编码/解码您的电子邮件
Encode? code>方块未设为电子邮件参数 b $ b
- Add View Results Tree listener, switch to
HTTP
tab and see what's actually being sent. - Make sure that
Encode?
box is unchecked for email parameter - Explicitly tell JMeter to decode email via __urldecode() function
Use a Beanshell Pre Processor to properly encode/decode your email
import java.net.URLDecoder;
import java.net.URLEncoder;
String email = "someone@example.com";
String encoded = URLEncoder.encode(email, "UTF-8");
String decoded = URLDecoder.decode(encoded, "UTF-8");
这篇关于%40未在Jmeter中解码为@的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!