MockInterceptor options.

interface PendingInterceptor {
    body?: string | RegExp | ((body) => boolean);
    consumed: boolean;
    data: MockDispatchData<object, Error>;
    headers?: Record<string, string | RegExp | ((body) => boolean)> | ((headers) => boolean);
    method?: string | RegExp | ((method) => boolean);
    origin: string;
    path: string | RegExp | ((path) => boolean);
    persist: boolean;
    query?: Record<string, any>;
    times: null | number;
}

Hierarchy (view full)

Properties

body?: string | RegExp | ((body) => boolean)

Body to intercept on.

Type declaration

    • (body): boolean
    • Parameters

      • body: string

      Returns boolean

consumed: boolean
data: MockDispatchData<object, Error>
headers?: Record<string, string | RegExp | ((body) => boolean)> | ((headers) => boolean)

Headers to intercept on.

Type declaration

    • (headers): boolean
    • Parameters

      • headers: Record<string, string>

      Returns boolean

method?: string | RegExp | ((method) => boolean)

Method to intercept on. Defaults to GET.

Type declaration

    • (method): boolean
    • Parameters

      • method: string

      Returns boolean

origin: string
path: string | RegExp | ((path) => boolean)

Path to intercept on.

Type declaration

    • (path): boolean
    • Parameters

      • path: string

      Returns boolean

persist: boolean
query?: Record<string, any>

Query params to intercept on

times: null | number