0
I'm new to jmeter. Jmeter version I used is 5.1.1
And i want to use it to test my restful api service.
My api like: DELETE /cpro/v2/alertfiles/{filename}
Filename here will be /etc/config/testfile1.
The server could parse the filename if the curl command like:
curl -v -X DELETE http://restapisrv:8888/cpro/v2/alertfiles/%2Fetc%2Fconfig%2Ftestfile1?configmapName=zt3-cpro-server
I created a http request.
but the url sent by jmeter has decoded %2F to '/'. so the request looks like
DELETE /cpro/v2/alertfiles/etc/config/testfile1 which made the server return 404 since no such entry could be found.
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="delete alert file test1" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">restapisrv</stringProp>
<stringProp name="HTTPSampler.port">8888</stringProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.contentEncoding">utf-8</stringProp>
<stringProp name="HTTPSampler.path">/cpro/v2/alertfiles/%2Fetc%2Fconfig%2Ftestfile1?configmapName=zt3-cpro-server&namespace=default</stringProp>
<stringProp name="HTTPSampler.method">DELETE</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
</HTTPSamplerProxy>
I tried to use __urlencode(/etc/config/testfile1) in path, but it's the same result. I don't know how should i set the value of HTTPSmapler.path to keep the %2F. Any idea about that? Thanks for your help.
I think you need to add some illustrations,, to show the exact way to fix the issue! – Rajesh S – 2019-06-10T08:25:38.497