Turn captured responses into test fixtures
Need repeatable responses? Generate mocks from a HAR capture or compare two captures without uploading them.
Need repeatable responses? Generate mocks from a HAR capture or compare two captures without uploading them. Check locally in your browser. No upload. Jump to: What does it mean?, How to fix it, Break it, Ask your agent.
Example A synthetic inventory capture includes successful JSON and a missing-resource response.
2 mocks generated from 2 captured requests.
Generated mocks do not reproduce timing, streaming, authentication or server logic. Captured response bodies and URLs can contain sensitive values; review before sharing.
The HAR capture stays in your browser. Entries, bodies and the second capture are read here and never uploaded.
Nothing is sent to our server. This tool has no server step.
Findings
Info Review captured content before sharing
URLs and response bodies may contain credentials or personal data. This tool is not a sanitizer. Request headers and Set-Cookie are excluded from generated MSW and WireMock output.
Evidence
| Captured requests | 2 | |
|---|---|---|
| Emitted mocks | 2 | |
Request matching
Method GET Path /items Sent with requests under this path Headers Content-Type application/json Cache-Control private, max-age=60 Base64 body false Body characters 30 Method GET Path /missing Sent with requests under this path Headers None Base64 body false Body characters 9
Mock output or HAR diff
Show the mock output or har diff
import { http, HttpResponse, passthrough } from 'msw';
const fixtures = [
{
"method": "GET",
"url": "https://inventory.example/items",
"path": "/items",
"status": 200,
"headers": {
"Content-Type": "application/json",
"Cache-Control": "private, max-age=60"
},
"body": "{\"items\":[{\"id\":1,\"stock\":3}]}",
"base64": false
},
{
"method": "GET",
"url": "https://inventory.example/missing",
"path": "/missing",
"status": 404,
"headers": {},
"body": "Not found",
"base64": false
}
];
export const handlers = [http.all('*', async ({ request }) => {
const body = ['GET', 'HEAD'].includes(request.method) ? undefined : await request.clone().text();
const r = fixtures.find(x => x.method === request.method && x.url === request.url && (x.requestBody === undefined || x.requestBody === body));
if (!r) return passthrough();
const payload = r.base64 ? Uint8Array.from(atob(r.body), c => c.charCodeAt(0)) : r.body;
return new HttpResponse([204, 205].includes(r.status) || request.method === 'HEAD' ? null : payload, { status: r.status, headers: r.headers });
})];
Take it further
What this result means
Written for the example.
Ask for a review of the findings and a test that verifies the proposed fix. Input values are not included automatically.
A synthetic inventory capture includes successful JSON and a missing-resource response.
A synthetic inventory capture includes successful JSON and a missing-resource response.
Check representative input and one deliberate failure. Confirm the result in the application that consumes it.
Read the findings before changing the input. Break it lets you inspect a failure, and Heal it restores the previous input.
Generated mocks do not reproduce timing, streaming, authentication or server logic. Captured response bodies and URLs can contain sensitive values; review before sharing.
How it works
HAR to Mocks reads har capture locally and presents findings with the evidence behind them. A synthetic inventory capture includes successful JSON and a missing-resource response. The full method, every rule and worked examples are on docs.tamperbox.dev.
Limits and interpretation
Generated mocks do not reproduce timing, streaming, authentication or server logic. Captured response bodies and URLs can contain sensitive values; review before sharing. Inputs are limited to 1,000,000 characters per field. Nothing is fetched from addresses embedded in input. Explicit copies and downloads are under your control.
Frequently asked questions
Is my input uploaded?
No. Parsing and output generation run in your browser. Source values are not sent to a server.
What does the opening example demonstrate?
A synthetic inventory capture includes successful JSON and a missing-resource response. It is synthetic data. Replace it with your own input to inspect a different case.
Does a passing result prove my application works?
No. Generated mocks do not reproduce timing, streaming, authentication or server logic. Captured response bodies and URLs can contain sensitive values; review before sharing. Verify the result in your test environment before relying on it.
References
Are you an AI agent? You are in the right place.
Read this tool as plain text with its methods and limits. Use the website interface; no dedicated MCP operation is available.