Reputation: 4798
I have a problem with preparing HTTP Requers in jMeter from the curl command I have:
curl --insecure -X POST -H "Content-Type:multipart/form-data" --header
'header-param-1: aGVhZGVyLXBhcmFtLTE=' --header 'header-param-2: aGVhZGVyLXBhcmFtLTI='
--header 'header-param-3: aGVhZGVyLXBhcmFtLTM=' -F "file=@C:\temp\file to upload.zip"
--form "metadata={\"jsonParam1\": \"text1\", \"jsonParam2\": 999, \"jsonParam3\": 10222,
\"jsonParam4\": \"2017-10-13T23:23:02.677Z\", \"jsonParam5\": \"text5\",
\"jsonParam6\": \"3\", \"fileName\": \"file to upload.zip\",
\"fileType\": \"application/pdf\"};type=application/json"
"http://localhost:7001/context/rest/v1/uploadservice"
Basically, it is sending a file as multipart/form-data and json in the body as application/json type. The curl command is working as expected, but I couldn't make jMeter do the same.
I tried to find proper solution and ended up with a promise that manually constructing body data would help, but I had no luck with it.
I am using Cygwin for curl, since I use Windows. I also tried to use postman, but also failed to configure it.
Please help.
Upvotes: 1
Views: 2193
Reputation: 168092
Just record the request.
file to upload.zip
to "bin" folder of your JMeter installationWorkBench -> HTTP(S) Test Script Recorder
and click "Start"Run your "curl" command like:
curl -x http://localhost:8888 --insecure -X POST -H ......
Test Plan -> Thread Group -> Recording Controller
References:
Upvotes: 1
Reputation: 34536
Create an HTTP Request with Header Manager as child
Where HTTP Request "Parameters" panel is configured like this:
And "Files Upload" panel in it:
Upvotes: 1