简体   繁体   中英

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:

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 :

URL https://api.something.com

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

Body field_1: value_1 field_2: value_2

For the above data, the autocannon CLI command would look something like below:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM