Constructor
Every field is optional. The request method is irrelevant and the body is ignored β all parameters travel in the query string.
Live URL preview
Rebuilt as you edit. This is the exact URL you call.
https://arttron.dev/api/fail?status=500&rate=1Response
Fill in the constructor and send a request to see the status, headers, body and elapsed time.
One-click examples
Call it from your code
curl -i 'https://arttron.dev/api/fail?status=500&rate=1'const res = await fetch('https://arttron.dev/api/fail?status=500&rate=1');
console.log(res.status, await res.text());import axios from 'axios';
try {
const res = await axios.get('https://arttron.dev/api/fail?status=500&rate=1');
console.log(res.status, res.data);
} catch (err) {
console.log(err.response?.status, err.response?.data);
}What is an HTTP error simulator?
An HTTP error simulator answers a request with a deliberately wrong response so you can exercise the failure path of a client. Instead of unplugging a service or waiting for a real outage, you ask for an exact status β say 503, or 429 β and the tool returns it. Point your code at the simulator URL and watch how it behaves. This page is the browser front end for the /api/fail endpoint: the same engine that powers the simulate_http_error MCP tool.
Realistic failures are rarely a lone 500. A flaky API fails only some of the time, a rate limit hands back a Retry-After, a provider stamps its own error shape (OpenAI, Stripe, AWS XML, Cloudflare), a gateway stalls before timing out and a connection can simply drop. The simulator reproduces each of those: an error rate from 0 to 1, a fixed or random delay, a per-key sequence for retry tests, a Retry-After override, provider-shaped bodies in JSON, text, HTML or XML, a dropped connection and a hung response. A seed makes the random status and delay reproducible.
How to use the HTTP error simulator
- Set the status (or a comma-separated list a random one is drawn from) and, if you want intermittent failures, an error rate below 1.
- Add a delay, a sequence with a scenario key, a Retry-After override, a provider preset and a body format as needed.
- Copy the live URL into curl, fetch or axios β or press Send to call it right here and read the status, headers, body and elapsed time.
- Switch to one of the one-click examples (flaky API, rate limit, retry, slow, drop) to see a realistic failure in one move.
Frequently asked questions about the HTTP error simulator
Why is a dropped connection not a real disconnect?
The Next.js App Router exposes no raw socket API, so a true socket destroy is unavailable. The route sends the response head and then aborts the body stream, so clients observe a network error (terminated / fetch failed) rather than a clean status. The response carries X-Sim-Drop: true so the emulation is explicit.
How does the sequence mode work?
With seq and a key, the n-th request for that key answers the n-th code in the list, then the sequence repeats. The counter lives per key for one hour and is refreshed on every hit, so a retry test keeps its order across a whole run.
Is this tool free and does it need a key?
The site front end calls /api/fail on the site plane, so no key is needed from this page. Scripts may authenticate with an API key; the endpoint is rate limited to 60 requests per minute per IP.
