Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble in passing "=" (equal) symbol in subsequent request - Jmeter

I newly started using jmeter. my application returns an url with encryption value as response which has to be passed as request to get the next page. The encryption value always ends with "=" ex. "http://mycompany.com/enc=EncRypTedValue=". while passing the value as request, the "=" is replaced with some other character like '%3d' ex "http://mycompany.com/enc=EncRypTedValue%3d" . Since the token has been changed my application is not serving the request.

like image 218
user2990770 Avatar asked Jan 11 '23 21:01

user2990770


1 Answers

It took me a while to understand this, unlike other languages and environments in network standards URIs (URLs) do not use quotes or some escape characters to hide special characters.

Instead, a URL needs to be properly encoded by encoding each individual parameter separately in order to build the complete URL. In JavaScript encoding/decoding of the parameters is done with encodeURIComponent() and decodeURIComponent() respectively.

For example, the following:

http://example.com/?p1=hello=hi&p2=three=3

should be encoded using encodeURIComponent() on each parameters to build the following:

http://example.com/?p1=hello%3Dhi&p2=three%3D3

  • Note that the equal sign used for parameters p1= ... p2= remain as is.
  • Do not try encode/decode the whole URL, it won't work. :)
  • Do not be fooled by what is displayed on a browser address bar/field, that is only the human friendly string, the moment you copy it to the clipboard the browser will encoded it.

Hope this helps someone.

like image 118
Meryan Avatar answered Jan 25 '23 23:01

Meryan