下载
这个下载有些慢,可以网盘获取:
链接:https://pan.baidu.com/s/1PzwGCcrWNwdn6R2Cpr11Xw 密码:t8rk
简单运行
java -jar moco-runner-0.12.0-standalone.jar http -p 9090 -c foo.json
foo.json
[
{
"response": {
"text": "foo"
}
}
]
Post
JSON
配置文件
[
{
"request": {
"text": "foo"
},
"response": {
"text": "bar"
}
},
{
"request": {
"uri": "/json",
"text": {
"json": "{\"foo\":\"bar\"}"
}
},
"response": {
"text": "foo"
}
}
]
请求一:
POST http://localhost:9090/json
Accept: */*
Cache-Control: no-cache
{"foo":"bar"}
响应一:
POST http://localhost:9090/json
HTTP/1.1 200 OK
Content-Length: 3
Content-Type: text/plain; charset=utf-8
foo
请求二:
GET http://localhost:9090
Accept: */*
Cache-Control: no-cache
foo
响应二:
GET http://localhost:9090
HTTP/1.1 200 OK
Content-Length: 3
Content-Type: text/plain; charset=utf-8
bar
Bar启动
目录结构
启动命令
@echo off
java -jar [moco-runner-0.12.0-standalone.jar](moco-runner-0.12.0-standalone.jar) http -p 7890-c moco_data.json
echo server start success! port is 7890
pause
启动
来源:oschina
链接:https://my.oschina.net/wuxinshui/blog/3164893