diff --git a/types/fetch-mock/index.d.ts b/types/fetch-mock/index.d.ts index e75cb6f2b8..0231d8b208 100644 --- a/types/fetch-mock/index.d.ts +++ b/types/fetch-mock/index.d.ts @@ -16,6 +16,7 @@ declare namespace fetchMock { * Mock matcher function */ type MockMatcherFunction = (url: string, opts: MockRequest) => boolean; + /** * Mock matcher. Can be one of following: * string: Either @@ -39,38 +40,45 @@ declare namespace fetchMock { * Set the response body */ body?: string | {}; + /** * Set the response status * @default 200 */ status?: number; + /** * Set the response headers. */ headers?: { [key: string]: string }; + /** * If this property is present then a Promise rejected with the value * of throws is returned */ throws?: boolean; + /** * This property determines whether or not the request body should be * JSON.stringified before being sent * @default true */ sendAsJson?: boolean; + /** * Setting this property to true will automatically add the * content-length header * @default true */ includeContentLength?: boolean; + /** * The URL the response should be from (to imitate followed redirects * - will set redirected: true on the response) */ redirectUrl?: string; } + /** * Response: A Response instance - will be used unaltered * number: Creates a response with this status @@ -86,6 +94,7 @@ declare namespace fetchMock { | string | Promise | {} | Promise<{}> | MockResponseObject | Promise; + /** * Mock response function */ @@ -105,32 +114,39 @@ declare namespace fetchMock { * clash) */ name?: string; + /** * http method to match */ method?: string; + /** * key/value map of headers to match */ headers?: { [key: string]: string }; + /** * key/value map of query strings to match, in any order */ query?: { [key: string]: string }; + /** * as specified above */ matcher?: MockMatcher; + /** * This option allows for existing routes in a mock to be overwritten. * It’s also possible to define multiple routes with ‘the same’ matcher. * Default behaviour is to error */ overwriteRoutes?: boolean; + /** * as specified above */ response?: MockResponse | MockResponseFunction; + /** * integer, n, limiting the number of times the matcher can be used. * If the route has already been called n times the route will be @@ -208,6 +224,7 @@ declare namespace fetchMock { * @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