Merge pull request #21177 from vicros0723/fetch-mock-match-headers

fetch-mock: Add type for matching headers.
This commit is contained in:
Ron Buckton
2017-11-03 21:29:14 -07:00
committed by GitHub
2 changed files with 9 additions and 0 deletions
+5
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);
+4
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
*/