0

我正在尝试在Autocannon POST 请求中传递标头和 x-www-form-urlencoded 正文,但我的响应始终是:

0 2xx responses, 5 non 2xx responses

命令行示例:

autocannon -c 1 -a 5 -H Authorization="Bearer xxxx",Content-Type="application/x-www-form-urlencoded" -b "Key"="Value" http://host.com:8080/path
4

2 回答 2

3

对每个标头使用 -H 标志,如下所示: autocannon -c 1 -a 5 -H "Authorization":"Bearer xxxx" -H "Content-Type":"application/x-www-form-urlencoded" -b '{ “键”=“值”}' http://host.com:8080/path

于 2021-05-06T17:46:27.940 回答
0

假设您有以下数据,并且您想使用 POST 请求x-www-form-urlencoded

网址 https://api.something.com

Headers Authorization: Bearer some-extra-long-uuid= Content-Type: application/x-www-form-urlencoded

正文 字段_1:值_1 字段_2:值_2

对于上述数据,autocannonCLI 命令如下所示:

autocannon -m POST -H "Authorization":"Bearer some-extra-long-uuid=" -H "Content-Type":"application/x-www-form-urlencoded" -b "field_1=value_1&field_2=value_2" https://api.something.com
于 2022-01-20T13:49:55.317 回答