Issue
I have a curl request and i don't know how to transform it in jmeter
:
curl -H application-id:my-app-id \
-H secret-key:my-secret-key \
-H Content-Type:"multipart/form-data" \
-H application-type:REST \
--form upload=@/logo.jpg \
-X POST \
-v \
http://localhost:8080/api/v1/files/Photos/logo.jpg
What is the best way of doing this?
Solution
Option 1: Record the request
In JMeter:
- File -> Templates -> Recording -> Create
- Workbench -> HTTP(S) Test Script Recorder -> Start
In console:
curl -x localhost:8888 -H application-id:my-app-id ......
Option 2: Building Request Manually
Add HTTP Request sampler and configure it as follows:
- Server Name:
localhost
- Port Number:
8080
- Method:
POST
- Path:
/api/v1/files/Photos/logo.jpg
- Check
Use multipart/form-data
for POST - Switch to "Files Upload" tab
- Click "Add" and provide full path to logo.jpg file,
upload
as Parameter Name andimage.jpg
as MIME Type
- Server Name:
Add HTTP Header Manager and provide your headers names and values there
References:
Answered By - Dmitri T Answer Checked By - Marie Seifert (WPSolving Admin)