@ is not getting decoded to @ in Jmeter

2019-03-02 10:29发布

问题:

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.

回答1:

It should be totally expected.

If you're logging in via GET request %40 is correct way of encoding @ symbol.

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:

  1. Add View Results Tree listener, switch to HTTP tab and see what's actually being sent.
  2. Make sure that Encode? box is unchecked for email parameter
  3. Explicitly tell JMeter to decode email via __urldecode() function
  4. 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");
    


回答2:

This is coming when we do via Parameters, If we do using "Body Data" that would work fine.

I used this way. {"password":"${password}","emailId":"${emailId}"}



回答3:

For the HTTP Request, Change the Client implementation to Java

  1. Select the Advanced tab from the HTTP Request
  2. In Client Implementation > Choose Java in Implementation