Update api-test with better formatting, so we can easily send doc

requests over to Dru with all the right information
This commit is contained in:
Kris Moore
2016-01-07 10:24:09 -05:00
parent 0694be78bf
commit a606d58af3

View File

@@ -11,6 +11,12 @@ if [ $? -ne 0 ] ; then
exit 1
fi
pkg info p5-JSON >/dev/null 2>/dev/null
if [ $? -ne 0 ] ; then
echo "Please install p5-JSON first"
exit 1
fi
if [ ! -d "${HOME}/.npm/ws" ] ; then
npm install ws
if [ $? -ne 0 ] ; then
@@ -57,6 +63,12 @@ echo ""
. ./utils/resty -W "http://127.0.0.1:12151" -H "Accept: application/json" -H "Content-Type: application/json" -u ${fuser}:${fpass}
# Check the reply of this REST query
echo ""
echo "REST Request:"
echo "-------------------------------"
echo "PUT /${namesp}/${name}"
echo "${payload}" | perl -0007 -MJSON -ne'print to_json(from_json($_, {allow_nonref=>1}),{pretty=>1})."\n"'
echo ""
echo "REST Response:"
echo "-------------------------------"
@@ -68,6 +80,11 @@ fi
# Now check the response via WebSockets
echo ""
echo "WebSocket Request:"
echo "-------------------------------"
echo "{ \"namespace\":\"${namesp}\", \"name\":\"${name}\", \"id\":\"fooid\", \"args\":${payload} }" | perl -0007 -MJSON -ne'print to_json(from_json($_, {allow_nonref=>1}),{pretty=>1})."\n"'
echo ""
echo "WebSocket Response:"
echo "-------------------------------"