首页 > 解决方案 > 如何在 Autocannon 中传递标头和 x-www-form-urlencoded 正文

问题描述

我正在尝试在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

标签: performancehttpperformance-testingwrk

解决方案


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


推荐阅读