umocker
1.1.3 • Public • Published
- install Node.js
$ npm install -g umocker
- 修改接口返回参数:
$ umocker -sr replace_response_data /path/to/api_config.json
- 修改接口Response Code:
$ umocker -sr replace_response_status_code /path/to/api_config.json
- 修改接口host:
$ umocker -sr reverse_proxy /path/to/api_config.json
- 修改接口请求参数:
$ umocker -sr replace_request_option /path/to/api_config.json
- 限速(kb/s):
$ umocker -st 10
- 延迟response返回:
$ umocker -sr pause_response_time /path/to/api_config.json
- 抓取HTTPs请求:默认支持,电脑和手机需要配置证书
- 多个接口同时配置,见示例中
修改接口返回参数
,扩充字典即可
- 保存接口请求到文件:
$ umocker -sf /path/to/file
- 配置文件
/path/to/api_config.json
,hostname
和pathname
为必选参数。
- 修改接口返回参数:
{
"apis": [
{
"hostname": "api.douban.com",
"pathname": "/v2/user/test",
"name": "test"
}
]
}
{
"apis": [
{
"hostname": "api.douban.com",
"pathname": "/v2/user/test",
"statusCode": "304"
}
]
}
{
"apis": [
{
"hostname": "api.douban.com",
"pathname": "/v2/user/test",
"host": "127.0.0.1"
}
]
}
{
"apis": [
{
"hostname": "api.douban.com",
"pathname": "/v2/user/test",
"ver": "5.10.2"
}
]
}
{
"apis": [
{
"hostname": "api.douban.com",
"pathname": "/v2/user/test",
"pauseTime": "1500"
}
]
}
Package Sidebar
Install
Weekly Downloads