mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
[fetch-mock v7.4.0] Add options.body for request body matching (#40133)
* add tests for request body matching feature added in https://github.com/wheresrhys/fetch-mock/pull/448 * add `options.body` for request body matching See https://github.com/wheresrhys/fetch-mock/pull/448/files * add test to match request body to array
This commit is contained in:
committed by
Pranav Senthilnathan
parent
c8287ed1e7
commit
d36a3b44e4
@@ -111,6 +111,9 @@ fetchMock.get("http://test.com", 200, {method: "GET"});
|
||||
fetchMock.get("http://test.com", 200, {method: "GET", overwriteRoutes: true});
|
||||
fetchMock.get("http://test.com", 200, {overwriteRoutes: true});
|
||||
fetchMock.post("http://test.com", 200, {method: "POST"});
|
||||
fetchMock.post("http://test.com", 200, {method: "POST", body: "abc"});
|
||||
fetchMock.post("http://test.com", 200, {method: "POST", body: {foo: "bar"}});
|
||||
fetchMock.post("http://test.com", 200, {method: "POST", body: ["foo", "bar"]});
|
||||
fetchMock.put("http://test.com", 200, {method: "PUT"});
|
||||
fetchMock.delete("http://test.com", 200, {method: "DELETE"});
|
||||
fetchMock.head("http://test.com", 200, {method: "HEAD"});
|
||||
|
||||
5
types/fetch-mock/index.d.ts
vendored
5
types/fetch-mock/index.d.ts
vendored
@@ -144,6 +144,11 @@ declare namespace fetchMock {
|
||||
*/
|
||||
headers?: { [key: string]: string | number };
|
||||
|
||||
/**
|
||||
* body to match
|
||||
*/
|
||||
body?: string | {};
|
||||
|
||||
/**
|
||||
* key/value map of query strings to match, in any order
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user