UNPKG

1.28 kBTypeScriptView Raw
1import type { local } from 'webdriver';
2import type { Cookie } from '@wdio/protocols';
3export type MockFilterOptions = {
4 method?: string | ((method: string) => boolean);
5 requestHeaders?: Record<string, string> | ((headers: Record<string, string>) => boolean);
6 responseHeaders?: Record<string, string> | ((headers: Record<string, string>) => boolean);
7 statusCode?: number | ((statusCode: number) => boolean);
8};
9type Overwrite<T, Request> = T | ((request: Request) => T);
10type Methods = 'POST' | 'GET' | 'DELETE' | 'PUT' | 'PATCH' | 'OPTIONS' | 'HEAD';
11export interface RequestWithOptions {
12 body?: Overwrite<any, local.NetworkBeforeRequestSentParameters>;
13 cookies?: Overwrite<Cookie[], local.NetworkBeforeRequestSentParameters>;
14 headers?: Overwrite<Record<string, string>, local.NetworkBeforeRequestSentParameters>;
15 method?: Overwrite<Methods, local.NetworkBeforeRequestSentParameters>;
16 url?: Overwrite<string, local.NetworkBeforeRequestSentParameters>;
17}
18export interface RespondWithOptions extends Omit<RequestWithOptions, 'url' | 'method'> {
19 statusCode?: Overwrite<number, local.NetworkResponseCompletedParameters>;
20}
21export interface MockRequestOptions {
22 requestWith?: RequestWithOptions;
23}
24export {};
25//# sourceMappingURL=types.d.ts.map
\No newline at end of file