Add http api test scripts

This commit is contained in:
gongdewei
2020-03-30 19:10:21 +08:00
parent 40ee92fa00
commit ac375a80fd
2 changed files with 112 additions and 0 deletions
+92
View File
@@ -0,0 +1,92 @@
###
POST http://localhost:8563/api
Accept: */*
Cache-Control: no-cache
{
"action": "init_session"
}
###
POST http://localhost:8563/api
Accept: */*
Cache-Control: no-cache
{
"action": "join_session",
"sessionId":"c8940459-dacb-4798-b721-7f58728b76c8"
}
###
POST http://localhost:8563/api
Accept: */*
Cache-Control: no-cache
{
"action": "async_exec",
"command": "watch demo.MathGame primeFactors 'params' -n 3 ",
"sessionId":"8132aa34-3e9a-477d-b20d-488032ba76b2"
}
###
POST http://localhost:8563/api
Accept: */*
Cache-Control: no-cache
{
"action": "async_exec",
"command": "version ",
"sessionId":"c8940459-dacb-4798-b721-7f58728b76c8"
}
###
POST http://localhost:8563/api
Accept: */*
Cache-Control: no-cache
{
"action": "async_exec",
"command": "session ",
"sessionId":"c8940459-dacb-4798-b721-7f58728b76c8"
}
###
### SYNC REST API
###
POST http://localhost:8563/api
Accept: */*
Cache-Control: no-cache
{
"action": "exec",
"command": "watch demo.MathGame primeFactors 'params' -n 3 ",
"sessionId":"8132aa34-3e9a-477d-b20d-488032ba76b2"
}
###
POST http://localhost:8563/api
Accept: */*
Cache-Control: no-cache
{
"action": "exec",
"command": "session",
"sessionId":"8132aa34-3e9a-477d-b20d-488032ba76b2"
}
###
POST http://localhost:8563/api
Accept: */*
Cache-Control: no-cache
{
"action": "exec",
"command": "version",
"sessionId":"8132aa34-3e9a-477d-b20d-488032ba76b2"
}
###
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
sum=0
i=1
while(( i <= 100 ))
do
let "i += 1"
curl -XPOST http://localhost:8563/api -d @<(cat << EOF
{
"action": "pull_results",
"sessionId":"$1",
"consumerId": "$2"
}
EOF)
echo ""
done
echo "count=$i"