I have a file with this content:

helper?token=99999 method=POST contents='{"key1":99999, "key2":88888, "key3":55}'

and then I run this command:

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

But the server is not getting any json. I already tried different escape options without success.

And the same post with curl it works perfectly.

Do you have any pointer in posting json with httperf?

thanks in advance

有帮助吗?

解决方案

You have to add an explicit carriege return to the end of the header, like this:

--add-header='Content-Type:application/json\n'

其他提示

Example with header, post and ssl

httperf --server yourhost.com.com --uri /smartlog --num-conns=500 --rate=500 --ssl  --method POST --wsesslog=100000,0,httprefpost_data.txt --add-header "sdk:3.0\nconfig:3.0\nzid:0\n"

create file (httprefpost_data.txt) with below content:

/smartlog method=POST contents='data=testing&uid=13'

Use the following to break the URL into server and URI:

httperf --print-reply --print-request --server "hostname.com" --uri="rest of url"

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top