Search code examples
jsonresthttperf

httperf to test an json rest api


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


Solution

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

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