我有一个包含以下内容的文件:
helper?token=99999 method=POST contents='{"key1":99999, "key2":88888, "key3":55}'
然后我运行这个命令:
httperf --print-reply --print-request --hog --client=0/1 --server=a_server --port=8080 --uri=/ --rate=25 --send-buffer=4096 --recv-buffer=16384 --add-header='Content-Type:application/json' --method=POST --wsesslog=1,1.000,entrada_carga
但是服务器没有收到任何 json。我已经尝试过不同的逃生选项,但没有成功。
同一篇文章与curl 完美配合。
你有关于用 httperf 发布 json 的任何指针吗?
提前致谢
最佳答案
您必须在 header 末尾添加显式回车符,如下所示:
--add-header='Content-Type:application/json\n'
关于json - httperf 测试 json Rest api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13588874/