Moco使用简单指导
发布日期:2021-08-15 09:33:42 浏览次数:12 分类:技术文章

本文共 1434 字,大约阅读时间需要 4 分钟。

需要java运行环境支持。下载jar包:moco-runner-<version>-standalone.jar

 

下面是参考:

配置

Moco的配置文件格式使用的是json。例如:

[  {    "response" :      {        "text" : "Hello, Moco"      }  }]

请求响应配置

{  "request" :    {      "uri" : "/foo"    },  "response" :    {      "text" : "bar"    }}

多文件配置

[    {        "include" : "foo.json"    },    {        "include" : "bar.json"    }]
其中,foo.json和bar.json都是包含服务的配置文件。启动参数必须使用-g。
 
[    {        "request": {            "method": "post",            "uri": "/tenants/login",                    "forms":  {                "email": "guiyun.wei@pekall.com",                "password": "123"            }        },        "response": {            "json": {                "status": 0,                "uid": 1                        }        }    },    {        "request": {            "method": "post",            "uri": "/tenants/login",                    "forms":  {                "email": "guiyun.wei@pekall.com",                "password": "1234"            }        },        "response": {            "json": {                "status": 1                    }        }    },    {        "request": {            "method": "post",            "uri": "/tenants/logout",                    "forms":  {                "email": "guiyun.wei@pekall.com"            }        },        "response": {            "json": {                "status": 0                    }        }    }]

 

转载于:https://www.cnblogs.com/javawer/p/3596426.html

转载地址:https://blog.csdn.net/weixin_30757793/article/details/99562765 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:普瑞马法则——抗击惰性生活方式
下一篇:Linux:Ubuntu下部署Web运行环境

发表评论

最新留言

很好
[***.229.124.182]2024年03月22日 11时35分53秒