v14.2
Example • mock-server

In-Browser Mock Server

With mock-server="true", <rapi-doc> answers requests from the spec inside the page, for Try and for the page's own fetch() calls. Pick a status code and a delay below and call the API.

Live Interactive Playground

Test In-Page Fetch Interception Live

The <rapi-doc> element below is mounted with mock-server="true". Use the live test controls to trigger actual window.fetch() requests from this page, and see them intercepted and resolved with mock data in real time!

Frontend fetch() TesterINTERCEPTOR READY
GET https://reqres.in/api/users (List Paginated)
GET https://reqres.in/api/users/2 (Single User)
POST https://reqres.in/api/users (Create User)
Auto (First 2xx)
200 OK
400 Bad Request
404 Not Found
500 Server Error
Cycle (200 → 400 → 500)
Random Chaos (200 / 500)
0ms (Instant)
300ms (Fast 4G)
800ms (Slow Network)
1500ms (High Latency)
Status:ReadyTime:0ms
Intercepted in-memory
// Click "Execute In-Page fetch()" above to test interception...
Live <rapi-doc mock-server="true">MOCKING BADGE IN UI

In Your Own Pages

The attributes, the per-operation status map, what the mock answers and how to use it while you build your app are in the docs. For a mock that runs as an HTTP server, see rapidoc mock.