API Core - v1.5.0
    Preparing search index...

    Function mockFetchResponse

    • Build a fetch-compatible Response covering the surface HttpClient.request relies on: .status, .ok, .text() (through parseBody), and — through readHeaders.headers.entries() and .headers.getSetCookie(). Nothing in the client reads .headers.get(). A null-body status (204, 205, 304) gets the null body the Response constructor insists on.

      Parameters

      • body: unknown

        Response body; objects are JSON-serialised (and default the content-type to JSON), strings pass through.

      • headers: Record<string, string | string[]> = {}

        Response headers; set-cookie may be an array.

      • status: number = HTTP_OK

        Response status (defaults to 200).

      Returns Response

      A Response sufficient for the transport tests.