UNPKG

1.3 kBMarkdownView Raw
1# fetch-mock
2
3Features include:
4
5- mocks most of the fetch API spec, even advanced behaviours such as streaming and aborting
6- declarative matching for most aspects of a http request, including url, headers, body and query parameters
7- shorthands for the most commonly used features, such as matching a http method or matching one fetch only
8- support for delaying responses, or using your own async functions to define custom race conditions
9- can be used as a spy to observe real network requests
10- can be extended with your own reusable custom matchers that can be used both for matching fetch-calls and inspecting the results
11- isomorphic, and supports either a global fetch instance or a locally required instance
12
13## Requirements
14
15@fetch-mock requires either of the following to run:
16
17- [Node.js](https://nodejs.org/) 18+ for full feature operation
18- Any modern browser that supports the `fetch` API
19- [node-fetch](https://www.npmjs.com/package/node-fetch) when testing in earlier versions of Node.js (this is untested, but should mostly work)
20
21## Documentation and Usage
22
23See the [project website](https://www.wheresrhys.co.uk/fetch-mock/)
24
25## License
26
27fetch-mock is licensed under the [MIT](https://github.com/wheresrhys/fetch-mock/blob/master/LICENSE) license.
28Copyright © 2024, Rhys Evans