سؤال

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