BUPKIS
    Preparing search index...

    Interface RequestMatchOptions

    Options for request matching assertions.

    // Match POST requests with specific body
    expect(server, 'to have handled request to', '/api/users', {
    method: 'POST',
    body: { name: 'Alice' },
    });

    // Match requests with specific headers
    expect(server, 'to have handled request to', '/api/users', {
    headers: { authorization: /^Bearer / },
    });

    // Match request count
    expect(server, 'to have handled request to', '/api/users', { times: 3 });
    expect(server, 'to have handled request to', '/api/users', {
    once: true,
    });
    interface RequestMatchOptions {
        body?: unknown;
        headers?: Record<string, string | RegExp>;
        method?: string;
        once?: boolean;
        times?: number;
    }
    Index

    Properties

    body?: unknown

    Expected request body (uses "to satisfy" semantics for matching).

    headers?: Record<string, string | RegExp>

    Expected headers. Values can be strings (exact match) or RegExp patterns.

    method?: string

    HTTP method to match (case-insensitive).

    once?: boolean

    Shorthand for times: 1.

    times?: number

    Exact number of times the request should have been made.