1.1.3 • Published 7 years ago

umocker v1.1.3

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

安装

  • install Node.js
  • $ npm install -g umocker

使用

  • $ umocker -h

支持功能

  • 修改接口返回参数:$ 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.jsonhostnamepathname为必选参数。
  • 修改接口返回参数:
{
  "apis": [
    {
      "hostname": "api.douban.com",
      "pathname": "/v2/user/test",
      "name": "test"
    }
  ]
}
  • 修改接口Response Code:
{
  "apis": [
    {
      "hostname": "api.douban.com",
      "pathname": "/v2/user/test",
      "statusCode": "304"
    }
  ]
}
  • 修改接口host:
{
  "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"
    }
  ]
}
  • 延迟response返回ms():
{
  "apis": [
    {
      "hostname": "api.douban.com",
      "pathname": "/v2/user/test",
      "pauseTime": "1500"
    }
  ]
}
1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago