You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@fetch-mock/core

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fetch-mock/core

Mock http requests made using fetch

0.7.1
latest
Source
npm
Version published
Weekly downloads
382
-28.33%
Maintainers
0
Weekly downloads
 
Created
Source

@fetch-mock/core

Work in progress reimplememntation of fetch-mock.

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

Requirements

@fetch-mock/core requires either of the following to run:

  • Node.js 18+ for full feature operation
  • Any modern browser that supports the fetch API
  • node-fetch when testing in earlier versions of Node.js (this is untested, but should mostly work)

Documentation and Usage

See the project website

License

@fetch-mock/core is licensed under the MIT license. Copyright © 2024, Rhys Evans

Keywords

fetch

FAQs

Package last updated on 25 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts