Core Concepts
Delay and failure simulation
Use delay and failure simulation to test slow networks, flaky endpoints, and error states on purpose. These controls apply to endpoints in MOCK mode. Delay is applied for both normal responses and simulated failures.
Configure
- Select the endpoint.
- Open the endpoint Settings tab.
- Set Delay (ms). Example: 750 adds a 750ms delay before the response is returned.
- Set Failure rate between 0 and 1.0 means never fail. 0.2 means fail about 20% of requests. 1 means always fail.
- Optional: configure a custom failure response (status, headers, body). This is what Mockphine returns when a simulated failure happens.
Delay and failure controls
Screenshot placeholder
Placeholder screenshot of Delay (ms), Failure rate, and custom failure response fields.
Default failure response
If you set a failure rate but do not configure a custom failure response, Mockphine returns:
HTTP/1.1 500 Internal Server Error
content-type: application/json
{ "error": "mock_failure" }Example configuration
If you want a specific error contract, define a custom failure response:
Delay (ms): 750
Failure rate: 0.2
Failure response status: 503
Failure response headers:
content-type: application/json
Failure response body:
{
"error": "service_unavailable",
"message": "Try again.",
"request_id": "example"
}Tip: If you omit a content-type header in the custom failure response, Mockphine defaults to application/json. If you return plain text or HTML, set content-type explicitly.
Verify
Verify the behavior in Live View: you should see a mix of success and failure status codes for the endpoint, with served-by remaining mock.