fetch-mock
Advanced tools
Comparing version 10.0.0 to 10.0.1
{ | ||
"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. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
180537
5431