如何在JMeter中使用curl请求? [英] How to use curl request in JMeter?
本文介绍了如何在JMeter中使用curl请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的curl命令:
I have such curl command:
curl -X POST -T "{sample_data.csv}" -H "Content-Type: text/csv" https://api.mysite.com/v1/jobs/upload.json?key={api_key}
问题是我不知道我应该在JMeter的哪个组件中传递"{sample_data.csv}"
文件以上传到端点.
The problem is I don't understand in which component in JMeter I should pass "{sample_data.csv}"
file to upload to the endpoint.
现在我有这样的配置:
当我运行测试时,它向我显示:
When I run test it shows me:
"error":{"message":"Un-Acceptable format, Content-Type must be one of those listed in \"formats\" but you sent \"multipart/form-data; boundary=E-VEr1-ZesF7xja5HezBWptB6xP_gsGODn\"","formats":["text/csv","text/plain","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/json","application/xml","application/vnd.oasis.opendocument.spreadsheet"]}}
推荐答案
- 将协议"更改为
https
- 取消选中对POST使用多部分/表单数据"
- 在随请求发送文件"中,单击添加"并提供文件位置
- 添加 HTTP标头管理器以发送"Content-Type"标头的值为"text/csv"
- Change "Protocol" to
https
- Uncheck "Use multipart/form-data for POST"
- In "Send Files With the Request" click "Add" and provide file location
- Add HTTP Header Manager to sent "Content-Type" header with the value of "text/csv"
这篇关于如何在JMeter中使用curl请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文