Networking & HTTP

MSW Handler Generator

Generate Mock Service Worker handlers from an OpenAPI document or a HAR file.

  • Draft kept in this tabYour draft is kept in this tab's session storage and cleared when the tab closes.
  • Runs in your browserProcessing happens in this page. No application server receives your input.
More options

OpenAPI 3.x or HAR 1.2 source

Generated MSW handlers

What this tool does

Turns an OpenAPI 3.x description or a HAR 1.2 capture into Mock Service Worker (msw 2.x) request handlers (one per operation or per captured request) with response bodies generated from the schema or taken from the capture shape.

Secret scrubbing and static-asset filtering

Credentials found in a HAR capture headers (such as Authorization tokens, cookies, and API keys flagged by classifySecret) are never written into generated handler code. Static assets in HAR captures are skipped automatically.

Honest limits

It writes handlers; it does not run them. Generated bodies are samples, not fixtures: from an OpenAPI schema they are the smallest valid instance (example and default are used when present, otherwise a type-shaped placeholder) and from a HAR they are the recorded response shape, because readHar discarded the actual bodies and this tool cannot reproduce content it never held. Path parameters become MSW path segments; query and header parameters are not matched on, so two operations differing only by query string produce two handlers with the same path and the second is reported as shadowed rather than silently dropped. Credentials found in a HAR headers are not written into the generated file at all: a mock does not need them, and classifySecret decides which fields those are. Generated code targets the msw 2.x API and is not type-checked here.

Scope: this covers the page itself. Your browser, operating system, clipboard, downloads, extensions, and crash recovery may keep copies, and a compromised site origin would not be protected.