简体   繁体   English

如何在 Autocannon 中传递标头和 x-www-form-urlencoded 正文

[英]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.

相关问题 .net如何测量仅下载httpPost正文(不包括httpPost标头)和上传数据所花费的时间 - .net How to measure time taken to download just the httpPost body excluding httpPost headers and upload data 如何将Bean shell处理器变量传递给jmeter中的HTTP Request body数据 - How to pass Bean shell processor variable in to HTTP Request body data in jmeter 为什么 Clinic.js 和 Autocannon 返回 0 个 2xx 响应,36164 个非 2xx 响应? - Why are clinic.js and Autocannon returning 0 2xx responses, 36164 non 2xx responses? 如何减慢域名服务器级别的WWW? - How to slow down WWW on nameserver level? 如何使用WebRequest仅下载标题 - How to download only the headers with WebRequest 如何将过期标头添加到Meteor静态资产 - How to add expiration headers to Meteor static assets 如何确定看起来像这样的东西的大O:(x -1)+(x-2)+(x-3)…(x-x) - How to determine big O of something that looks like this: (x -1) + (x - 2) + (x - 3) … (x - x) 如何一次对齐所有jtable单元格和标头? - How to align all jtable cells and headers at once? 是否有内置的matlab计算二次形式(x'* A * x)? - Is there a matlab built-in that calculates the quadratic form (x'*A*x)? 如何为amazon s3图像添加Expires标头? - How to Add Expires headers for amazon s3 images?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM