UNPKG

playwright-fluent

Version:
26 lines (25 loc) 1.04 kB
import { Page, Request } from 'playwright'; import { HttpHeaders, HttpRequestMethod } from '../../../utils'; export interface MockedResponse<T> { status: number; headers: HttpHeaders; contentType: string; body: T; } export interface RequestInterceptionFilterOptions { /** * Intercepts only requests with the given method (GET, POST, ...). * By default all requests to the given url are intercepted for every HTTP verbs * * @type {HttpRequestMethod} * @memberof RequestInterceptionFilterOptions */ method?: HttpRequestMethod; /** * Predicate that will enable you to bypass request interception on custom conditions * * @memberof RequestInterceptionFilterOptions */ bypassPredicate?: (request: Request) => boolean; } export declare function onRequestToRespondWith<T>(url: string, options: Partial<RequestInterceptionFilterOptions>, response: Partial<MockedResponse<T>> | ((request: Request) => Partial<MockedResponse<T>>), page: Page | undefined): Promise<void>;