Image 带有图像文件内容的Apache测试台测试帖子

Image 带有图像文件内容的Apache测试台测试帖子,image,http,post,http-post,apachebench,Image,Http,Post,Http Post,Apachebench,我有一个通过http POST接受图像文件的web服务,我使用curl发送它们,例如: curl -X POST -F "image=@ta1.jpeg" -F "image=@ta2.jpeg" http://domain.tld/upload 我正试图用apachebench(ab)对并发请求进行测试。 我看到ab可以选择-p发布数据,但我认为这需要JSON内容。。。我尝试使用postmanecho服务将我的图像编码为JSON: curl -X POST -F "image=@ta1.jp

我有一个通过http POST接受图像文件的web服务,我使用
curl
发送它们,例如:

curl -X POST -F "image=@ta1.jpeg" -F "image=@ta2.jpeg" http://domain.tld/upload
我正试图用apachebench(
ab
)对并发请求进行测试。 我看到
ab
可以选择
-p
发布数据,但我认为这需要JSON内容。。。我尝试使用
postman
echo服务将我的图像编码为JSON:

curl -X POST -F "image=@ta1.jpeg" -F "image=@ta2.jpeg" http://www.postman-echo.com/post
将输出保存到文件,并使用
ab
-p
选项发送,但生成服务器错误


有关于如何使用apache bench测试发布图像的提示吗?

您是否尝试过设置内容类型

ab -n 1 -p post -T application/x-www-form-urlencoded -p ta1.jpeg http://domain.tld/upload
当您试图发布json文件时,您需要设置json内容类型:

ab -n 1 -p post -T application/json -p ta1.json http://domain.tld/upload

对于这两种方法,我都遇到了一个错误
无法将POST与其他方法混合使用
在同一问题上挣扎,找到了答案