---
title: "Test File Downloads with Stable Public URLs | Mochavi Payloads"
description: "Test download buttons, content types, binary handling and saved files with small stable PDF, MessagePack and CBOR URLs."
canonical: "https://payloads.mochavi.com/guides/test-file-downloads"
markdown_mirror: "https://payloads.mochavi.com/guides/test-file-downloads.md"
language: "en"
generated_from: "Payloads source content"
---

> Canonical HTML: [https://payloads.mochavi.com/guides/test-file-downloads](https://payloads.mochavi.com/guides/test-file-downloads)
>
> This machine-readable Markdown page mirrors the canonical Payloads documentation.

# Test File Downloads with Stable Public URLs

Exercise real HTTP downloads without generating throwaway files or depending on a stateful fixture service.

## Short answer

Use a small immutable file URL with a declared media type and checksum. Payloads includes PDF, MessagePack and CBOR files plus text formats, all listed in one manifest with byte sizes and content-disposition metadata.

## Pick a fixture that matches the download path

| Scenario | Suggested fixture | Expected media type |
| --- | --- | --- |
| Inline PDF preview | /v1/files/pdf/dataset-summary.pdf | application/pdf |
| Binary save flow | /v1/users.msgpack | application/msgpack |
| Binary decoder input | /v1/users.cbor | application/cbor |
| CSV export flow | /v1/users.csv | text/csv; charset=utf-8 |

## Test the response before the UI

Check status, Content-Type and the number of received bytes before asserting browser-specific behaviour. This tells you whether a failure belongs to the HTTP layer, blob creation, filename handling or the final UI action.

**Browser download primitive**

```js
const response = await fetch("https://payloads.mochavi.com/v1/files/pdf/dataset-summary.pdf");
if (!response.ok) throw new Error(String(response.status));
if (response.headers.get("content-type") !== "application/pdf") {
  throw new Error("unexpected media type");
}
const file = await response.blob();
```

## Keep end-to-end checks focused

- Confirm that the control initiates one request.
- Assert the response media type and a non-zero body.
- Verify the intended inline or attachment behaviour.
- Use the manifest checksum when the exact saved bytes matter.
- Avoid testing a large file when a sub-kilobyte fixture exercises the same code.

## Know what is not being simulated

These files do not simulate interrupted transfers, slow responses, expiring links or authenticated downloads. Use a programmable HTTP service for those behaviours. Payloads is for the successful, reproducible file path.

- [Open the PDF guide](https://payloads.mochavi.com/formats/pdf)
- [Open the MessagePack guide](https://payloads.mochavi.com/formats/messagePack)
- [Open the CBOR guide](https://payloads.mochavi.com/formats/cbor)
- [Inspect sizes and checksums](https://payloads.mochavi.com/v1/manifest.json)
