下载moco-runner-0.11.0-standalone.jar包
启动moco,cmd到moco jar包目录下 :
Java –jar moco-runner-0.11.0-standalone.jar start –p 12306 –g onecoder.json
onecoder.json 文件
[ { "context": "/boy", "include": "boy.json" } ]
boy.json文件
[ { "request" : { "method":"post", "forms" : { "name" : "o" } }, "response" : { "text" : "Hi." }} ]
onecoder.json与boy.json文件放同一目录下
用poster工具访问:
发送post请求
请求提交后,moco-server会显示返回值“Hi.”