Route Behavior
Binary Responses
Not every response is JSON. Attach a file to a route — a PDF, a GZIP archive, a small image or audio clip — and MockBase serves it back exactly as uploaded, with a real binary Content-Type, so you can test how a client actually handles a binary response instead of only ever seeing JSON.
How it works
Click Attach file next to the response body editor and pick a file. The route switches from a JSON body to a binary one: the file's bytes are what gets served, with Content-Type taken from the file itself (falling back to application/octet-stream if the browser can't tell). Click Replace file to swap it for another, or the trash icon to remove it and go back to editing a JSON body — nothing is lost either way, since the JSON body you had is kept in the background while a binary file is attached.
A binary route is still a route like any other: method, path, status code, priority, and conditional matching all work exactly the same. Chaos injection also still applies and takes priority — a chaos-triggered request gets the usual JSON error body, not the file, the same as it would on a JSON route. Dynamic templates don't apply to a binary body, since there's no text to render Jinja2 into. A binary route is also versioned like any other: see Version History if a later edit needs to bring back a file that was since replaced.
The Request Inspector logs a byte count instead of the raw file for a binary response, since dumping binary data into the log wouldn't be readable anyway.
Text isn't a binary file
If what you actually want is a text payload you can type and edit — a SOAP envelope, some XML, CSV, or HTML — use Use XML instead of attaching a file. That keeps the body editable in place, and unlike a binary body it still supports templating. See SOAP & XML.
Limits
A binary file is capped at 300 KB. That travels inside the same request as the rest of your mock's configuration when you save, which has its own overall size limit — 300 KB keeps a file comfortably inside that even after the base64 encoding used to store it, which adds roughly a third to its size.
That's enough for a real PDF, a short audio clip, a gzip archive, or a small image — not a video file. This is for testing how your code handles a binary response, not for hosting media.