I read a csv file for input in my jmeter test plan. I name the first variable in the row query
.
I need it to encode spaces as %20
not +
. Using the __urlencode()
function like ${__urlencode(${query})}
encodes the spaces as +
the same way selecting the encode option on the parameter does in the above screenshot.
I don't think this is something you're really want as encoding the URL is not only about spaces.
You should use encodeURIComponent() function (or its equivalent). The way of calling it in JMeter via __javaScript function will look like:
If you just need to replace spaces with
%20
you can do it with __groovy() funciton like:Demo:
See Apache JMeter Functions - An Introduction article for more information on JMeter Functions concept.