URL encode variable in Jmeter

BlackHatSamurai picture BlackHatSamurai · Jan 29, 2013 · Viewed 27.1k times · Source

I need to encode a variable in Jmeter, but it isn't a parameter. For example:

URL path: /folder/guest/id;token=${token}/profile?details=yes

I want to encode the ${token} variable, and only the token variable. I know that you can select encode in the parameters section, but this isn't a parameter.

Does anyone know how to do this?

Answer

Irate Pirate picture Irate Pirate · Nov 1, 2013

JMeter as of version 2.10 now includes a urlencode function.

${__urlencode(${token})}

See http://jmeter.apache.org/usermanual/functions.html