-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathIResponseFaker.ts
20 lines (18 loc) · 918 Bytes
/
IResponseFaker.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import {Request, RespondOptions} from 'puppeteer';
import {RequestMatcher} from '../types/RequestMatcher';
export interface IResponseFaker {
/**
* @param interceptedRequest <Request>: puppeteers Request object to get the url from.
* @param matcher <(url: string, pattern: string): Promise<boolean> | boolean)>: matches the url with the pattern to block.
*
* checks if the ResponseFaker matches the Request and will provide a ResponseFake
*/
isMatchingRequest(interceptedRequest: Request, matcher: RequestMatcher): Promise<boolean> | boolean;
/**
* @param request <Request>: puppeteers Request object
* @return RespondOptions: RespondOptions as defined by puppeteer
*
* provides the ResponseFake to be used by the RequestInterceptor to fake the response of the request
*/
getResponseFake(request: Request): RespondOptions | Promise<RespondOptions>;
}