如何使用 curl 同时发送多个单独定义的 POST 请求?

问题描述 投票:0回答:0

我正在尝试测试我的应用程序是否可以同时处理多个带有自定义标头的 POST 请求。

我知道这个答案,并行运行多个 curl 命令,但它并不能完全满足我的需求:

我想发送多个预定义的 post 请求(请求主体在 .json 文件中定义),并且我想一次发送它们。

这就是我要去的地方。我错过了什么,或者这是执行此任务的合理方式吗?

curl --parallel --parallel-immediate --parallel-max 3 -u user:password -X POST -H "Content-Type: application/json" --data @data1.json -H "customheader: customheader1" http://localhost:8000/rest/api/2/entity/ -X POST -H "Content-Type: application/json" --data @data2.json -H "customheader: customheader2" http://localhost:8000/rest/api/2/entity/ -X POST -H "Content-Type: application/json" --data @data3.json -H "customheader: customeheader1" http://localhost:8000/rest/api/2/entity/ 

非常感谢!

json curl post simultaneous
© www.soinside.com 2019 - 2024. All rights reserved.