[英]How to pass Headers and x-www-form-urlencoded body in Autocannon
I'm trying to pass Headers and x-www-form-urlencoded body in Autocannon POST request, but my response is always:我正在尝试在Autocannon POST 请求中传递标头和 x-www-form-urlencoded 正文,但我的响应始终是:
0 2xx responses, 5 non 2xx responses
Example from command line:命令行示例:
autocannon -c 1 -a 5 -H Authorization="Bearer xxxx",Content-Type="application/x-www-form-urlencoded" -b "Key"="Value" http://host.com:8080/path
对每个标头使用 -H 标志,如下所示: autocannon -c 1 -a 5 -H "Authorization":"Bearer xxxx" -H "Content-Type":"application/x-www-form-urlencoded" -b '{ "Key"="Value"}' http://host.com:8080/path
Let's say you have the following data and you want to make a POST request using x-www-form-urlencoded
:假设您有以下数据,并且您想使用x-www-form-urlencoded
发出 POST 请求:
URL https://api.something.com网址https://api.something.com
Headers Authorization: Bearer some-extra-long-uuid= Content-Type: application/x-www-form-urlencoded Headers Authorization: Bearer some-extra-long-uuid= Content-Type: application/x-www-form-urlencoded
Body field_1: value_1 field_2: value_2正文字段_1:值_1 字段_2:值_2
For the above data, the autocannon
CLI command would look something like below:对于上述数据, autocannon
CLI 命令如下所示:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.