Mocks
The Mocks view (DevTools only, Alt + 3) changes what the inspected page receives for its GraphQL HTTP requests. Rules are stored per origin and listed in priority order: the first enabled rule that matches wins. The Mocks enabled switch turns every rule off at once.
Matching
Section titled “Matching”A rule matches on:
- a URL pattern (empty = any URL,
*matches any text, otherwise a substring), - an optional operation name,
- an optional variable condition (
user.idexists, or equals a JSON value).
Actions
Section titled “Actions”| Action | What the page gets |
|---|---|
| Replace response | Your JSON (and status). The request never leaves the page. |
| Patch response | The real request runs and your JSON is merged into its response (JSON Merge Patch: objects merge, null removes a key, anything else replaces). |
| Delay request | The real request, sent after N ms. |
| Fail with an error | A GraphQL error response with your message and status, or with Network failure, a failed request as if the network were down. |
| Pass through | Matching requests are left alone and no later rule is tried. |
Good to know
Section titled “Good to know”- Mocks apply only while DevTools is open on that tab. Closing it stops every mock. Reload the page to mock requests it makes while loading.
- Batches, multipart uploads, WebSockets and anything that isn’t GraphQL are never mocked.
- While mocks are active, rules (including mocked response bodies) are handed to the page’s own hook through a window message, so scripts running on that page could read them. Keep mock data free of secrets.
- A Mocks on · N chip shows next to the view switch whenever a rule can change a response. Mocked rows in Traffic carry a MOCKED chip and a banner naming the rule. The page’s console logs each mocked request.
- Mock this response in a Traffic row’s detail starts a rule from that response. Nothing is active until you save it and the master switch is on.
Palette commands: Show Mocks, Toggle mocks on/off, New mock rule, Disable all mock rules.
© 2026 Melliforge. All rights reserved.