@types/fetch-mock
Advanced tools
Comparing version 5.0.4 to 5.0.5
@@ -21,9 +21,9 @@ // Type definitions for fetch-mock 5.0.0 | ||
begin the url e.g. '^http://www.site.com' would match | ||
'http://www.site.com' or 'http://www.site.com/page.html' | ||
* '*' to match any url | ||
* RegExp: A regular expression to test the url against | ||
* Function(url, opts): A function (returning a Boolean) that is passed the | ||
url and opts fetch() is called with (or, if fetch() was called with one, | ||
the Request instance) | ||
*/ | ||
'http://www.site.com' or 'http://www.site.com/page.html' | ||
* '*' to match any url | ||
* RegExp: A regular expression to test the url against | ||
* Function(url, opts): A function (returning a Boolean) that is passed the | ||
url and opts fetch() is called with (or, if fetch() was called with one, | ||
the Request instance) | ||
*/ | ||
type MockMatcher = string | RegExp | MockMatcherFunction; | ||
@@ -51,3 +51,3 @@ | ||
of throws is returned | ||
*/ | ||
*/ | ||
throws?: boolean; | ||
@@ -57,4 +57,4 @@ /** | ||
JSON.stringified before being sent | ||
* @default true | ||
*/ | ||
* @default true | ||
*/ | ||
sendAsJson?: boolean; | ||
@@ -68,6 +68,6 @@ } | ||
converted into a json string and returned as the body of a 200 response | ||
* If MockResponseObject was given then it's used to configure response | ||
* Function(url, opts): A function that is passed the url and opts fetch() | ||
is called with and that returns any of the responses listed above | ||
*/ | ||
* If MockResponseObject was given then it's used to configure response | ||
* Function(url, opts): A function that is passed the url and opts fetch() | ||
is called with and that returns any of the responses listed above | ||
*/ | ||
type MockResponse = Response | Promise<Response> | ||
@@ -92,8 +92,8 @@ | number | Promise<number> | ||
references to the calls, grouped by name. | ||
* @default matcher.toString() | ||
* | ||
* Note: If a non-unique name is provided no error will be thrown | ||
(because names are optional, auto-generated ones may legitimately | ||
clash) | ||
*/ | ||
* @default matcher.toString() | ||
* | ||
* Note: If a non-unique name is provided no error will be thrown | ||
(because names are optional, auto-generated ones may legitimately | ||
clash) | ||
*/ | ||
name?: string; | ||
@@ -121,2 +121,22 @@ /** | ||
interface MockOptionsMethodGet extends MockOptions { | ||
method: 'GET' | ||
} | ||
interface MockOptionsMethodPost extends MockOptions { | ||
method: 'POST' | ||
} | ||
interface MockOptionsMethodPut extends MockOptions { | ||
method: 'PUT' | ||
} | ||
interface MockOptionsMethodDelete extends MockOptions { | ||
method: 'DELETE' | ||
} | ||
interface MockOptionsMethodHead extends MockOptions { | ||
method: 'HEAD' | ||
} | ||
interface FetchMockStatic { | ||
@@ -126,6 +146,6 @@ /** | ||
route, and optionally returns a mocked Response object or passes the | ||
call through to fetch(). Calls to .mock() can be chained. | ||
* @param matcher Condition for selecting which requests to mock | ||
* @param response Configures the http response returned by the mock | ||
*/ | ||
call through to fetch(). Calls to .mock() can be chained. | ||
* @param matcher Condition for selecting which requests to mock | ||
* @param response Configures the http response returned by the mock | ||
*/ | ||
mock(matcher: MockMatcher, response: MockResponse | MockResponseFunction): this; | ||
@@ -135,7 +155,7 @@ /** | ||
route, and optionally returns a mocked Response object or passes the | ||
call through to fetch(). Calls to .mock() 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 | ||
*/ | ||
call through to fetch(). Calls to .mock() 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 | ||
*/ | ||
mock(matcher: MockMatcher, response: MockResponse | MockResponseFunction, options: MockOptions): this; | ||
@@ -145,10 +165,60 @@ /** | ||
route, and optionally returns a mocked Response object or passes the | ||
call through to fetch(). Calls to .mock() can be chained. | ||
* @param options The route to mock | ||
*/ | ||
call through to fetch(). Calls to .mock() can be chained. | ||
* @param options The route to mock | ||
*/ | ||
mock(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() restricted to the GET | ||
method. Calls to .mock() 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 | ||
*/ | ||
get(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodGet): 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() restricted to the POST | ||
method. Calls to .mock() 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 | ||
*/ | ||
post(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodPost): 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() restricted to the PUT | ||
method. Calls to .mock() 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 | ||
*/ | ||
put(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodPut): 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() restricted to the | ||
DELETE method. Calls to .mock() 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 | ||
*/ | ||
delete(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodDelete): 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() restricted to the HEAD | ||
method. Calls to .mock() 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 | ||
*/ | ||
head(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodHead): this; | ||
/** | ||
* Chainable method that restores fetch() to its unstubbed state and | ||
clears all data recorded for its calls. | ||
*/ | ||
*/ | ||
restore(): this; | ||
@@ -162,3 +232,3 @@ /** | ||
them or not. | ||
*/ | ||
*/ | ||
calls(): MatchedRoutes; | ||
@@ -172,3 +242,3 @@ /** | ||
was matched. | ||
*/ | ||
*/ | ||
called(): boolean; | ||
@@ -178,3 +248,3 @@ /** | ||
named matcherName was matched. | ||
*/ | ||
*/ | ||
called(matcherName?: string): boolean; | ||
@@ -188,3 +258,3 @@ /** | ||
matcherName | ||
*/ | ||
*/ | ||
lastCall(matcherName?: string): MockCall; | ||
@@ -211,5 +281,5 @@ /** | ||
convert objects to JSON before sending. This is overrideable | ||
for each call but for some scenarios, e.g. when dealing with a | ||
lot of array buffers, it can be useful to default to `false` | ||
*/ | ||
for each call but for some scenarios, e.g. when dealing with a | ||
lot of array buffers, it can be useful to default to `false` | ||
*/ | ||
configure(opts: Object): void; | ||
@@ -216,0 +286,0 @@ } |
{ | ||
"name": "@types/fetch-mock", | ||
"version": "5.0.4", | ||
"version": "5.0.5", | ||
"description": "TypeScript definitions for fetch-mock 5.0.0", | ||
@@ -14,5 +14,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"@types/whatwg-fetch": "0.0.*" | ||
"@types/whatwg-fetch": "*" | ||
}, | ||
"typings": "index.d.ts" | ||
"typings": "index.d.ts", | ||
"typesPublisherContentHash": "4b8f9bdd9c4f3c9bfcb4458fcbb3f3fde97caed41de6da60353804097641d98c" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Tue, 06 Sep 2016 14:55:58 GMT | ||
* Last updated: Mon, 19 Sep 2016 17:28:58 GMT | ||
* File structure: ProperModule | ||
@@ -14,0 +14,0 @@ * Library Dependencies: whatwg-fetch |
@@ -26,3 +26,3 @@ { | ||
"hasPackageJson": false, | ||
"contentHash": "a20afd21d6bf5a9c1b8b1a4ba5f3d7b643acef65e7aa9bf5f57f5f191c09136e" | ||
"contentHash": "4b8f9bdd9c4f3c9bfcb4458fcbb3f3fde97caed41de6da60353804097641d98c" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12493
288
0
197597
Updated@types/whatwg-fetch@*