Request Body
To send payloads to an API (such as in POST, PUT, or PATCH requests), Rumour provides a structured [body] block. Rumour supports robust dynamic values, automatic Content-Type synchronization, and path-based file uploads.
1. Syntax & Configuration
For sending payloads, specify a dedicated [body] section in your TOML request file:
[body]
type = "json"
raw = """
{
"name": "Jane Smith",
"role": "developer"
}
"""
Fields
type: The serialization format. Supported formats include:json(Default): SetsContent-Type: application/json.text: SetsContent-Type: text/plain.form: URL-encoded or multipart form data.urlencoded: SetsContent-Type: application/x-www-form-urlencoded.xml: SetsContent-Type: application/xml.binary: SetsContent-Type: application/octet-stream.
raw: The content of the body. You can use TOML's triple-quote (""") multiline string syntax for formatting complex payloads like raw JSON or XML blocks.
When using the [body] table, Rumour automatically computes and injects the corresponding standard Content-Type header unless you have explicitly overridden the header in your [headers] section.
2. Directory Structure
To demonstrate all request body types, we use a dataset containing different body payloads. The directory structure is organized as follows:
body_example/
├── workspace.env.toml
├── body_example.config.toml
├── body_example.suite.toml
├── auth/
│ ├── auth.suite.toml
│ └── requests/
│ └── login.toml
└── users/
├── users.suite.toml
└── requests/
├── assets/
│ ├── data.bin
│ └── test_pic.png
├── create_user.toml
├── download_image.toml
├── post_binary.toml
├── post_form.toml
├── post_text.toml
├── post_urlencoded.toml
└── post_xml.toml
3. Explaining Body Types with Examples
Below is a breakdown of how to use each body type, including the TOML requests and the verbose output traces.
A. JSON (Default)
The json type serializes the raw string and attaches a Content-Type: application/json header. Variables inside the raw JSON payload are dynamically resolved.
Request File: users/requests/create_user.toml
# users/requests/create_user.toml
[dependencies]
"../../auth/requests/login.toml" = "token"
[request]
method = "POST"
url = "{{base_url}}/post"
[headers]
Authorization = "Bearer {{../../auth/requests/login.token}}"
[body]
type = "json"
raw = """
{
"name": "Jane Smith",
"client": "{{client_name}}",
"stage": "{{env.ENV_STAGE}}",
"key": "{{vault.SECURE_KEY}}",
"timestamp": "{{timestamp}}",
"nonce": "req-{{random}}"
}
"""
[variables]
client_name = "RumourTestAgent/2.0"
Command
RUMOUR_VAULT_PASS=mypassword123 rumour run users/requests/create_user.toml -tv
Output Trace
POST https://httpbin.org/post
Header: Content-Type: application/json
URL: https://httpbin.org/post
Body (json): {"username": "admin", "token": "session_secret_xyz123"}
✓ SUCCESS: /home/bugsfounder/workspace/testing/body_example/auth/requests/login.toml (5484ms)
POST https://httpbin.org/post
Header: Authorization: Bearer session_secret_xyz123
Header: Content-Type: application/json
URL: https://httpbin.org/post
Body (json): {
"name": "Jane Smith",
"client": "RumourTestAgent/2.0",
"stage": "staging",
"key": "super_secure_vault_value_987",
"timestamp": "1779390967347",
"nonce": "req-9dfbc001"
}
✓ SUCCESS: /home/bugsfounder/workspace/testing/body_example/users/requests/create_user.toml (1611ms)
✓ login.toml → PASS (0 Pass, 0 Fail, 0 Skip)
✓ create_user.toml → PASS (1 Pass, 0 Fail, 0 Skip)
╭──────────────────────────────────────────────────────────────────────────╮
│ RUMOUR EXECUTION REPORT │
├──────────────────────────────────────────────────────────────────────────┤
│ Total Requests: 2 │
│ Successful: 2 │
│ Failed: 0 │
│ Skipped: 0 │
│ Success Rate: 100.0% │
│ Total Time: 7095ms │
╰──────────────────────────────────────────────────────────────────────────╯
✓ Successful Requests:
- /home/bugsfounder/workspace/testing/body_example/auth/requests/login.toml [200] [5484ms]
- /home/bugsfounder/workspace/testing/body_example/users/requests/create_user.toml [200] [1611ms]
Actionable Recommendations:
→ Run with --json to export this report for your CI/CD pipeline.
B. Plain Text
The text type is used to transmit raw string sequences. It defaults the Content-Type header to text/plain.
Request File: users/requests/post_text.toml
# users/requests/post_text.toml
[request]
method = "POST"
url = "{{base_url}}/post"
[headers]
Content-Type = "text/plain"
[body]
type = "text"
raw = "Hello, this is a plain text body payload!"
Command
rumour run users/requests/post_text.toml -tv
Output Trace
POST https://httpbin.org/post
Header: Content-Type: text/plain
URL: https://httpbin.org/post
Body (text): Hello, this is a plain text body payload!
✓ SUCCESS: /home/bugsfounder/workspace/testing/body_example/users/requests/post_text.toml (1347ms)
✓ /home/bugsfounder/workspace/testing/body_example/users/requests/post_text.toml → PASS (1 Pass, 0 Fail, 0 Skip)
╭──────────────────────────────────────────────────────────────────────────╮
│ RUMOUR EXECUTION REPORT │
├──────────────────────────────────────────────────────────────────────────┤
│ Total Requests: 1 │
│ Successful: 1 │
│ Failed: 0 │
│ Skipped: 0 │
│ Success Rate: 100.0% │
│ Total Time: 1348ms │
╰──────────────────────────────────────────────────────────────────────────╯
✓ Successful Requests:
- /home/bugsfounder/workspace/testing/body_example/users/requests/post_text.toml [200] [1348ms]
Actionable Recommendations:
→ Run with --json to export this report for your CI/CD pipeline.
C. URL-Encoded Form
The urlencoded type formats the payload as application/x-www-form-urlencoded key-value pairs separated by ampersands.
Request File: users/requests/post_urlencoded.toml
# users/requests/post_urlencoded.toml
[request]
method = "POST"
url = "{{base_url}}/post"
[body]
type = "urlencoded"
raw = "username=admin&role=developer&status=active"
Command
rumour run users/requests/post_urlencoded.toml -tv
Output Trace
POST https://httpbin.org/post
Header: Content-Type: application/x-www-form-urlencoded
URL: https://httpbin.org/post
Body (urlencoded): username=admin&role=developer&status=active
✓ SUCCESS: /home/bugsfounder/workspace/testing/body_example/users/requests/post_urlencoded.toml (2211ms)
✓ /home/bugsfounder/workspace/testing/body_example/users/requests/post_urlencoded.toml → PASS (1 Pass, 0 Fail, 0 Skip)
╭──────────────────────────────────────────────────────────────────────────╮
│ RUMOUR EXECUTION REPORT │
├──────────────────────────────────────────────────────────────────────────┤
│ Total Requests: 1 │
│ Successful: 1 │
│ Failed: 0 │
│ Skipped: 0 │
│ Success Rate: 100.0% │
│ Total Time: 2213ms │
╰──────────────────────────────────────────────────────────────────────────╯
✓ Successful Requests:
- /home/bugsfounder/workspace/testing/body_example/users/requests/post_urlencoded.toml [200] [2213ms]
Actionable Recommendations:
→ Run with --json to export this report for your CI/CD pipeline.
D. Multipart Form-Data
The form type is used to build standard multipart form data.
- Values are specified line-by-line using
key = valuesyntax. - To attach files, prepend
@to the file path (e.g.,@assets/test_pic.png). File paths are resolved relative to the directory containing the request TOML file.
Request File: users/requests/post_form.toml
# users/requests/post_form.toml
[request]
method = "POST"
url = "{{base_url}}/post"
[body]
type = "form"
raw = """
username = admin
profile_pic = @assets/test_pic.png
"""
Command
rumour run users/requests/post_form.toml -tv
Output Trace
POST https://httpbin.org/post
Header: Content-Type: multipart/form-data; boundary=------------------------24ef130f1d3c01f6
URL: https://httpbin.org/post
✓ SUCCESS: /home/bugsfounder/workspace/testing/body_example/users/requests/post_form.toml (2964ms)
✓ /home/bugsfounder/workspace/testing/body_example/users/requests/post_form.toml → PASS (1 Pass, 0 Fail, 0 Skip)
╭──────────────────────────────────────────────────────────────────────────╮
│ RUMOUR EXECUTION REPORT │
├──────────────────────────────────────────────────────────────────────────┤
│ Total Requests: 1 │
│ Successful: 1 │
│ Failed: 0 │
│ Skipped: 0 │
│ Success Rate: 100.0% │
│ Total Time: 4201ms │
╰──────────────────────────────────────────────────────────────────────────╯
✓ Successful Requests:
- /home/bugsfounder/workspace/testing/body_example/users/requests/post_form.toml [200] [4201ms]
Actionable Recommendations:
→ Run with --json to export this report for your CI/CD pipeline.
E. XML
The xml type transmits raw structured XML payloads. To inform the target API, explicitly add Content-Type = "application/xml" in your [headers] section.
Request File: users/requests/post_xml.toml
# users/requests/post_xml.toml
[request]
method = "POST"
url = "{{base_url}}/post"
[headers]
Content-Type = "application/xml"
[body]
type = "xml"
raw = """
<user>
<name>Jane Smith</name>
<role>developer</role>
</user>
"""
Command
rumour run users/requests/post_xml.toml -tv
Output Trace
POST https://httpbin.org/post
Header: Content-Type: application/xml
URL: https://httpbin.org/post
Body (xml): <?xml version="1.0" encoding="UTF-8"?>
<request>
<user>
<username>john_doe</username>
<email>john@example.com</email>
</user>
</request>
✓ SUCCESS: /home/bugsfounder/workspace/testing/body_example/users/requests/post_xml.toml (2144ms)
✓ /home/bugsfounder/workspace/testing/body_example/users/requests/post_xml.toml → PASS (1 Pass, 0 Fail, 0 Skip)
╭──────────────────────────────────────────────────────────────────────────╮
│ RUMOUR EXECUTION REPORT │
├──────────────────────────────────────────────────────────────────────────┤
│ Total Requests: 1 │
│ Successful: 1 │
│ Failed: 0 │
│ Skipped: 0 │
│ Success Rate: 100.0% │
│ Total Time: 2145ms │
╰──────────────────────────────────────────────────────────────────────────╯
✓ Successful Requests:
- /home/bugsfounder/workspace/testing/body_example/users/requests/post_xml.toml [200] [2145ms]
Actionable Recommendations:
→ Run with --json to export this report for your CI/CD pipeline.
F. Binary Stream
The binary type is used to upload raw byte streams. It sets the Content-Type header to application/octet-stream.
- Prepend
@to a file path (e.g.@assets/data.bin) to read and stream the file's raw bytes. The file path is resolved relative to the request TOML file's location. - If the value does not start with
@, Rumour will transmit the raw string text directly.
Request File: users/requests/post_binary.toml
# users/requests/post_binary.toml
[request]
method = "POST"
url = "{{base_url}}/post"
[body]
type = "binary"
raw = "@assets/data.bin"
Command
rumour run users/requests/post_binary.toml -tv
Output Trace
POST https://httpbin.org/post
Header: Content-Type: application/octet-stream
URL: https://httpbin.org/post
Body (binary): @assets/data.bin
✓ SUCCESS: /home/bugsfounder/workspace/testing/body_example/users/requests/post_binary.toml (349ms)
4. Handling Binary Responses & File Downloads
When an API returns raw file payloads (such as images, music, or videos), Rumour automatically manages downloading and persisting the response stream to prevent terminal bloat and resource exhaustion.
A. Mime Type Detection
Rumour inspects the Content-Type header returned by the server.
- If the content type starts with
text/, or containsjson,xml,javascript,yaml,toml(or is empty), the response is processed as a standard Text response. - If the response is not classified as text (e.g.,
image/png,audio/mpeg,video/mp4), it is processed as a Binary response.
B. Automatic Saving Rules
- Binary payloads of any size are automatically written to disk.
- Text payloads larger than 2MB are also automatically saved to disk to maintain performance.
C. Filename Resolution Priority
Rumour determines the name of the saved file based on the following hierarchy:
- Content-Disposition: Looks for a
filename=attribute inside the response headers. - URL Path segment: If the last portion of the URL path contains a dot extension (e.g.
https://filesamples.com/samples/video/mp4/sample_640x360.mp4resolves tosample_640x360.mp4). - Fallback UUID: If no name can be resolved from headers or the URL path, Rumour generates a random UUID and infers the correct file extension (e.g.,
.png,.mp3) by parsing the magic bytes of the payload.
D. Overriding the Download Directory
By default, files are downloaded to /tmp/rumour/responses/. You can specify a custom directory using the --download-dir (or -d) CLI flag:
Request File: users/requests/download_image.toml
# users/requests/download_image.toml
[request]
method = "GET"
url = "https://httpbin.org/image/png"
Command
rumour run users/requests/download_image.toml -tv -d downloads
Output Trace
GET https://httpbin.org/image/png
URL: https://httpbin.org/image/png
✓ SUCCESS: /home/bugsfounder/workspace/testing/body_example/users/requests/download_image.toml (1257ms)
✓ /home/bugsfounder/workspace/testing/body_example/users/requests/download_image.toml → PASS (1 Pass, 0 Fail, 0 Skip)
╭──────────────────────────────────────────────────────────────────────────╮
│ RUMOUR EXECUTION REPORT │
├──────────────────────────────────────────────────────────────────────────┤
│ Total Requests: 1 │
│ Successful: 1 │
│ Failed: 0 │
│ Skipped: 0 │
│ Success Rate: 100.0% │
│ Total Time: 1258ms │
╰──────────────────────────────────────────────────────────────────────────╯
✓ Successful Requests:
- /home/bugsfounder/workspace/testing/body_example/users/requests/download_image.toml [200] [1258ms]
Actionable Recommendations:
→ Run with --json to export this report for your CI/CD pipeline.
The downloaded file is saved inside the downloads directory with a name like 41bbc361-0486-442a-91ce-d05adc50bde9.png (using the inferred .png format extension).
E. JSON Report Schema Attributes
When running in automation or pipeline systems (using the --json option), the execution report details where the file was saved:
body: Contains a short verification message (e.g.,[Binary Data: 8090 bytes saved to downloads/41bbc361-0486-442a-91ce-d05adc50bde9.png]).body_path: The file path pointing to the saved file (e.g.,downloads/41bbc361-0486-442a-91ce-d05adc50bde9.png).
Some servers (such as public file hosting sites protected by Cloudflare) may block or throttle client download requests that do not specify a standard browser identity.
If a download request hangs, times out, or fails with a 403 Forbidden or 429 Too Many Requests status, you can bypass anti-bot protection by adding a standard browser User-Agent header inside your request TOML file's [headers] section:
[headers]
User-Agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"