Fetch Mock

Mock http requests made using fetch
Alternatives To Fetch Mock
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Node Fetch8,474219,66833,6599 days ago94July 25, 2023190mitJavaScript
A light-weight module that brings the Fetch API to Node.js
Wretch4,170487922 days ago68June 28, 20234mitTypeScript
A tiny wrapper built around fetch with an intuitive syntax. :candy:
Use Http2,2775354 months ago102May 04, 202385mitTypeScript
🐶 React hook for making isomorphic http requests
Http Client1,8069015712 days ago183January 13, 2023mitPHP
Provides powerful methods to fetch HTTP resources synchronously or asynchronously
Cross Fetch1,58714,3084,9142 months ago49July 03, 202310mitJavaScript
Universal WHATWG Fetch API for Node, Browsers and React Native.
Fetch1,51435 months ago3September 05, 201991apache-2.0Java
The best file downloader library for Android
Fetch Mock1,2012,9352,1249 months ago204November 21, 202071mitJavaScript
Mock http requests made using fetch
Ngx Restangular78686132 years ago56August 14, 202027mitTypeScript
Restangular for Angular 2 and higher versions
Get Graphql Schema585452610 months ago6November 14, 201858TypeScript
Fetch and print the GraphQL schema from a GraphQL HTTP endpoint. (Can be used for Relay Modern.)
Apollo Fetch5814101064 years ago10December 06, 201734mitTypeScript
:dog: Lightweight GraphQL client that supports middleware and afterware
Alternatives To Fetch Mock
Select To Compare

Alternative Project Comparisons


Mock http requests made using fetch.

Features include:

  • mocks most of the fetch API spec, even advanced behaviours such as streaming and aborting
  • declarative matching for most aspects of a http request, including url, headers, body and query parameters
  • shorthands for the most commonly used features, such as matching a http method or matching one fetch only
  • support for delaying responses, or using your own async functions to define custom race conditions
  • can be used as a spy to observe real network requests
  • can be extended with your own reusable custom matchers that can be used both for matching fetch-calls and inspecting the results
  • isomorphic, and supports either a global fetch instance or a locally required instance

New If using jest, try the new fetch-mock-jest wrapper.

New Cheatsheet

node version licence npm downloads CircleCI Code coverage Known Vulnerabilities

fetchMock.mock('http://example.com', 200);
const res = await fetch('http://example.com');

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


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 or cheatsheet

If you're using jest as your test runner, consider using fetch-mock-jest, a lightweight, jest-friendly wrapper around fetch-mock.


fetch-mock is licensed under the MIT license. Copyright © 2019, Rhys Evans


npm version maintainability

Popular Fetch Projects
Popular Http Projects
Popular Networking Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.