From 549cb73af10048e27bf9b2d2aa9d7dc27b3b7255 Mon Sep 17 00:00:00 2001 From: Tom Liao Date: Wed, 1 Nov 2017 11:51:55 -0400 Subject: [PATCH] fetch-mock: Add type for matching headers. --- types/fetch-mock/fetch-mock-tests.ts | 5 +++++ types/fetch-mock/index.d.ts | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/types/fetch-mock/fetch-mock-tests.ts b/types/fetch-mock/fetch-mock-tests.ts index cfd595cb16..459c8e1076 100644 --- a/types/fetch-mock/fetch-mock-tests.ts +++ b/types/fetch-mock/fetch-mock-tests.ts @@ -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); diff --git a/types/fetch-mock/index.d.ts b/types/fetch-mock/index.d.ts index b8c47b1e97..13563277b4 100644 --- a/types/fetch-mock/index.d.ts +++ b/types/fetch-mock/index.d.ts @@ -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 */