fetch-mock: Add type for matching headers.

This commit is contained in:
Tom Liao
2017-11-01 11:51:55 -04:00
parent 21ec6bfb04
commit 549cb73af1
2 changed files with 9 additions and 0 deletions

View File

@@ -1,6 +1,11 @@
import * as fetchMock from "fetch-mock";
fetchMock.mock("http://test.com", 200);
fetchMock.mock("http://test.com", 200, {
headers: {
test: "header"
}
});
fetchMock.mock(/test\.com/, 200);
fetchMock.mock(() => true, 200);
fetchMock.mock((url, opts) => true, 200);

View File

@@ -96,6 +96,10 @@ declare namespace fetchMock {
* http method to match
*/
method?: string;
/**
* key/value map of headers to match
*/
headers?: { [key: string]: string };
/**
* as specified above
*/