English | 简体中文
npm install @tiandatong/anymock -g
λ anymock init
[AnyProxy Log][2018-11-15 12:35:52]: throttle :10000kb/s
[AnyProxy Log][2018-11-15 12:35:52]: clearing cache file...
[AnyProxy Log][2018-11-15 12:35:52]: ==>>> clearing cache
[AnyProxy Log][2018-11-15 12:35:52]: closing webserver...
[AnyProxy Log][2018-11-15 12:35:52]: Http proxy started on port 8001
[AnyProxy Log][2018-11-15 12:35:52]: Active rule is: a rule to hack response
- 自动创建一个名为mock 的目录, 其中包含*.config.json 和 mocks.json 配置模板 (默认 api.config.json 和 file.config.json), 也会生成一个根证书
- 信任根证书
- 通过Proxy SwitchyOmega把Chrome 的代理配置为http://127.0.0.1:8001
- 然后分别访问
- https://api.github.com/repos/temberature/anymock/branches?protected=0
- https://suggest.taobao.com/sug?code=utf-8&callback=KISSY.Suggest.callback&q=apple
- https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js
- 你就可以看到相应的mock 结果了。
[{
"name": "master1",
"commit": {
"sha": "51a0a39acfb1d029345e896cca6a6a2c3625816b",
"url": "https://api.github.com/repos/temberature/anymock/commits/51a0a39acfb1d029345e896cca6a6a2c3625816b"
}
}]
KISSY.Suggest.callback(
{
"result": [
[
"apple watch4",
"14770"
],
[
"apple pencil",
"12500"
]
],
"shop": "apple",
"tmall": "apple"
}
)
//uncompressed jquery
npm test
git clone https://github.com/temberature/anymock.git
cd anymock
npm install
npm start
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the MIT License - see the LICENSE.md file for details