标签:img 利用 image 技术 post 目录 cat 依赖关系 配置
1.安装配置jdk1.8
3.新建配置config.json,在jar包所在目录输入cmd,cmd 输入:java -jar moco-runner-0.10.0-standalone.jar http -p 9999 -c config.json,启动moco mock
jar下输入cmd,如下图:
成功启动mock,如下图
config.json 内容:
[
{
"request" :
{
"method": "get",
"uri" : "/1"
},
"response" :
{
"text" : "mock mo ren"
}
}
]
如config.json 内容:"text" : {
"template": "返回参数中文${req.queries[‘zw‘]}"
}
[
{
"request" :
{
"method": "get",
"uri" : "/cs/duo"
},
"response" :
{
"file" : "duocs.json"
}
},
{
"request" :
{
"method": "get",
"uri" : "/cs/dan"
},
"response" :
{
"file" : "dancs.json"
}
},
{
"request" :
{
"method": "get",
"uri" : "/temp"
},
"response" :
{
"text" : {
"template": "返回参数中文${req.queries[‘zw‘]}"
}
}
}
]
{
"name": "yiqiao",
"age": "30"
}
[
{
"name": "zhangshan",
"age": "28"
},
{
"name": "lishi",
"age": "38"
}
]
[
{
"request" :
{
"method": "post",
"uri" : "/posts",
"file": {
"json": "requestcs.json"
}
},
"response" :
{
"json": {"success": "true"}
}
},
{
"request" :
{
"method": "put",
"uri" : "/puts",
"file": {
"json": "requestcs.json"
}
},
"response" :
{
"json": {"success": "puttrue"}
}
},
{
"request" :
{
"method": "delete",
"uri" : "/deletes"
},
"response" :
{
"json": {"success": "deletetrue"}
}
}
]
{
"usename": "test",
"password" : "test"
}
1.访问post:结合配置文件config.json 内容:url:/posts;入参格式为:"json": "requestcs.json",返回json格式值 "success": "true",如下图postman操作:选择body-raw,选择josn(application/josn),输入URL:http://127.0.0.1:9999/posts,返回 "success": "true"
2.访问put
3.访问delete
标签:img 利用 image 技术 post 目录 cat 依赖关系 配置
原文地址:https://www.cnblogs.com/yiwenrong/p/12658585.html