0

I want to pass a date in dd/mm/yyyy format with POST request in Jmeter. When i pass dob parameter as 21/11/2011 in my request then final request become -

dob=21%2F11%2F2011&

How I will make my date as below -

dob=21/11/2011&

Below is my Jmeter snapshot - enter image description here

I also unchecked and checked the 'encode?' option but nothing happens. Its takes %2f.

zishan paya
  • 503
  • 1
  • 6
  • 29
  • are you passing the date using querystring? – SamGhatak May 17 '16 at 07:11
  • I am passing the date normally via CSV and also tried using dob=21/11/2011 in parameter request. – zishan paya May 17 '16 at 07:18
  • What I mean is is that querystring parameter or form parameter? If its a querystring one, you should be OK with it, The application you are testing should be able to handle it. – SamGhatak May 17 '16 at 10:13
  • I am not sure what querystring is. I have uploaded the jmeter snap shot and passing date as normal text dd/mm/yyyy format – zishan paya May 17 '16 at 10:38
  • Is it causing the application to break? because the screenshot you added looks OK and the application should be able to handle it. That is a standard behavior... @Md.ZishanPaya – SamGhatak May 17 '16 at 12:18
  • No tried the webservice using postman and application behave perfect. But with request '/' is replaced by %2f in jmeter which is creating problem with my request and not getting proper response. I also used UTF-8 in content encoding but no luck. – zishan paya May 17 '16 at 14:29

3 Answers3

0

basically the value is encoded i.e., "/" is getting replaced by %2F. use content encoding text box in http sampler value to appropriate hence it will not encode.

refer the below

Encoding URL query parameters in Java

Community
  • 1
  • 1
Suman g
  • 477
  • 3
  • 14
0

reference screen This the place i mentioned to set the content encoding. if you dont set any by default what you have set must go as it is i.e., "/" as "/" only , by chance in any place content encoding is to some other value (eg: "UTF-8" ) then the setter will do its job , i.e., converting "/" to %2F

Suman g
  • 477
  • 3
  • 14
  • un check the encode in your initial screen and try. – Suman g May 17 '16 at 12:28
  • I also used UTF-8 in content encoding but no luck. I don't understand why my post request parameter having '/' converted to %2f even after hard-coding under value or fetching date from CSV. – zishan paya May 17 '16 at 14:32
  • try this way 1. with no Encode? [the pic you attached]checked and no content encoding provided 2. No Encode? and provide content encoding as UTF-8 3rd like wise take ..since i dont have a case to work for you but wanted to give solution – Suman g May 17 '16 at 15:06
0

Add a pre processor script as child to HTTP sampler and try adding the below code

sampler.addNonEncodedArgument("dob","12/12/12","=")

Note: Make sure in your http sampler, you have not added "dob" argument , here we are adding dob progrmatically, so only one place dob should exist that is in script only.

i hope this should work.

Suman g
  • 477
  • 3
  • 14