BUPKIS
    Preparing search index...

    Interface TrackedRequest

    Represents a tracked HTTP request with its parsed details.

    Captured when MSW handles a request through the response:mocked lifecycle event.

    const server = createTrackedServer(http.get('/api/users', () => ...));
    server.listen();
    await fetch('http://localhost/api/users');

    const [request] = server.trackedRequests;
    console.log(request.method); // 'GET'
    console.log(request.pathname); // '/api/users'
    interface TrackedRequest {
        body: unknown;
        bodyPromise: Promise<unknown>;
        headers: Record<string, string>;
        method: string;
        pathname: string;
        request: Request;
        requestId: string;
        response?: Response;
        timestamp: number;
        url: string;
    }
    Index

    Properties

    body: unknown

    Parsed request body (JSON, text, or undefined).

    Note: This may be undefined initially while async parsing completes. Use bodyPromise to await the parsed body.

    bodyPromise: Promise<unknown>

    Promise that resolves to the parsed request body.

    Await this to ensure body parsing is complete before checking body content.

    headers: Record<string, string>

    Request headers as a key-value record.

    method: string

    HTTP method (GET, POST, etc.).

    pathname: string

    URL pathname (without query string).

    request: Request

    The original Request object from the fetch event.

    requestId: string

    MSW's unique identifier for this request.

    response?: Response

    The mocked Response object, if available.

    timestamp: number

    Timestamp when the request was tracked (ms since epoch).

    url: string

    Full URL string of the request.