English | 简体中文
- support https
- support jsonp and JSON API
- support resources replace(js\css etc.)
Some principle of this project:
- Unix philosophy: Do One Thing and Do It Well
- form follows function
npm install @tiandatong/anymock -g
run command below anywhere
λ 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
-
first run with 'init' will create a directory 'mock' contains *.config.json and mocks.json template(default api.config.json and file.config.json), and generate root cert
-
trust the root cert
-
configure chrome's proxy to http://127.0.0.1:8001 via Proxy SwitchyOmega
-
then you can browse
-
https://api.github.com/repos/temberature/anymock/branches?protected=0
-
https://suggest.taobao.com/sug?code=utf-8&callback=KISSY.Suggest.callback&q=apple
-
and see the corresponding mock result
[{
"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
Explain how to run the automated tests for this system
Explain what these tests test and why
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