@4c/fetch-mock 中文文档教程
fetch-mock
使用 fetch
fetchMock.mock('http://example.com', 200);
const res = await fetch('http://example.com');
assert(res.ok);
fetchMock.restore();
Table of Contents
我花了大量时间免费维护 fetch-mock。 我不要求付款,但正在为难民慈善机构筹款 - 请考虑捐款
Requirements
fetch-mock 需要以下内容才能运行:
- Node.js 8+ for full feature operation
- Node.js 0.12+ with limitations
- npm (normally comes with Node.js)
- Either of the following
- node-fetch when testing in a nodejs
- A browser that supports the
fetch
API when testing in a browser
Documentation and Usage
请参阅 项目网站
License
fetch-mock 已根据 MIT 许可证。 版权所有 © 2019,Rhys Evans
Housekeeping
fetch-mock
Mock http requests made using fetch
fetchMock.mock('http://example.com', 200);
const res = await fetch('http://example.com');
assert(res.ok);
fetchMock.restore();
Table of Contents
I devote a lot of time to maintaining fetch-mock for free. I don't ask for payment, but am raising money for a refugee charity - please consider donating
Requirements
fetch-mock requires the following to run:
- Node.js 8+ for full feature operation
- Node.js 0.12+ with limitations
- npm (normally comes with Node.js)
- Either of the following
- node-fetch when testing in a nodejs
- A browser that supports the
fetch
API when testing in a browser
Documentation and Usage
See the project website
License
fetch-mock is licensed under the MIT license. Copyright © 2019, Rhys Evans