> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.doc-detective.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.doc-detective.com/_mcp/server.

# mockRequest

> Reference for the `mockRequest` schema.

## Referenced In

* [test](/reference/schemas/test)
* [Resolved context](/reference/schemas/resolved-context)

## Fields

| Field       | Type                                                  | Description                                                                                                                                                                                                                                                                                                          | Default |
| :---------- | :---------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------ |
| mockRequest | object([mockRequest](/reference/schemas/mockrequest)) | Required. Answer matching browser requests with a fixed response, a sequence of responses, or the responses recorded in a HAR file, from this step until the test ends. A later `mockRequest` for the same `url` and `method` replaces the earlier one. Runs only in Chrome. In other browsers, the step is skipped. | —       |

## Examples

```json
{
  "mockRequest": {
    "url": "**/api/invoices*",
    "response": {
      "body": {
        "next": "2026-12-03"
      }
    }
  }
}
```

```json
{
  "mockRequest": {
    "url": "https://api.example.com/user",
    "method": "GET",
    "response": {
      "statusCode": 200,
      "headers": {
        "content-type": "application/json"
      },
      "bodyPath": "fixtures/user.json"
    }
  }
}
```

```json
{
  "mockRequest": {
    "url": "**/api/jobs/1",
    "responses": [
      {
        "body": {
          "status": "running"
        }
      },
      {
        "body": {
          "status": "done"
        }
      }
    ]
  }
}
```

```json
{
  "mockRequest": {
    "harPath": "fixtures/app.har",
    "url": "**/api/**"
  }
}
```