请求正文在负载testing中不正确
我正在使用loadtest来加载我的节点应用程序。 我有问题通过loadtest发送请求。 请求的forms是:
loadtest http://localhost:7000/eth/checkEthBalance -T "application/x-www-form-urlencoded" -H "application/x-www-form-urlencoded" -m "POST" --data '{"accountAddress":"0x62720366ef403c9891e2bfbd5358ee3c8a57b113"}' -n 1
但在req.body
,我得到:
{ '{"accountAddress":"0x62720366ef403c9891e2bfbd5358ee3c8a57b113"}': '' }
代替:
{"accountAddress":"0x62720366ef403c9891e2bfbd5358ee3c8a57b113"}
然而,一个curl请求工厂:
curl -X POST \ http://localhost:7000/eth/checkEthBalance \ -H 'cache-control: no-cache' \ -H 'content-type: application/x-www-form-urlencoded' \ -H 'postman-token: 0bf637f7-2037-c4ca-29a7-cc2310786317' \ -d accountAddress=0x62720366ef403c9891e2bfbd5358ee3c8a57b113
不知道负载testing有什么问题。 任何帮助?
在这里,我是如何做到的,你需要传递-T 'application/json'
示例: loadtest -P '{"name" : "ashok dey", "email" : "ashokdey@gmail.com", "password" : "password123"}' -c 100 --rps 2000 http://localhost:3434/register -T 'application/json'
传递包含发布数据的文件时,必须通过相同的步骤。