Socket
Socket
Sign inDemoInstall

fetch-mock

Package Overview
Dependencies
Maintainers
1
Versions
226
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-mock - npm Package Compare versions

Comparing version 10.0.0 to 10.0.1

2

package.json
{
"name": "fetch-mock",
"version": "10.0.0",
"version": "10.0.1",
"description": "Mock http requests made using fetch (or isomorphic-fetch)",

@@ -5,0 +5,0 @@ "main": "./cjs/server.js",

@@ -189,2 +189,6 @@ import fetchMock = require('..');

const stickySandbox = fetchMock.sandbox();
stickySandbox.sticky("http://test.com", 200);
stickySandbox.mock("http://test.com", 200, { sticky: true });
const response: fetchMock.MockResponseObject = {

@@ -191,0 +195,0 @@ throws: new Error('error'),

@@ -30,3 +30,3 @@ // Project: https://github.com/wheresrhys/fetch-mock, http://www.wheresrhys.co.uk/fetch-mock

type MockMatcherUrl = string | RegExp;
type MockMatcherUrl = string | RegExp | URL;

@@ -232,2 +232,8 @@

matchPartialBody?: boolean;
/**
* Avoids a route being removed when reset(), restore() or resetBehavior() are called.
* Note - this does not preserve the history of calls to the route
*/
sticky?: boolean;
}

@@ -309,2 +315,14 @@

* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() which creates a route
* that persists even when restore(), reset() or resetbehavior() are called.
* Calls to .sticky() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
sticky(matcher: MockMatcher | MockOptions, response: MockResponse | MockResponseFunction, options?: MockOptions): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() limited to being

@@ -311,0 +329,0 @@ * called one time only. Calls to .once() can be chained.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc