Skip to main content

Inherited Params

The [params] section in a collection config file injects URL query parameters into every request in that directory. This is ideal for API versioning, feature flags, or debug parameters that must be present on all requests.

Defining Inherited Params

# api/api.config.toml

[params]
api_version = "v2"
format = "json"
debug = "false"

All requests under api/ automatically get ?api_version=v2&format=json&debug=false appended to their URLs.

note

All parameter values must be strings in TOML. Use debug = "false" not debug = false.

Override Rules

PrioritySource
1 (Highest)Request-level [params] in the .toml file
2Nearest parent .config.toml params
3Further-up parent .config.toml params

If a request defines api_version = "v3" locally, that overrides the inherited v2.

Variable Interpolation

Param values support full variable resolution:

[params]
client_id = "{{vault.oauth_client_id}}"
locale = "{{user_locale}}"
version = "{{api_version}}"

Example

The following example was verified against the local mock server. It demonstrates how a directory inherits parameters from the root config, and how a local request can override them.

File Layout

config_examples/03_inherited_params/
├── workspace.env.toml
├── api.config.toml
└── users/
├── get_alpha_team.toml
└── get_beta_team.toml

workspace.env.toml

base_url = "http://localhost:4000/api/v2"

api.config.toml

[params]
team = "alpha"

users/get_alpha_team.toml

name = "verify_inherited_params_alpha"

[request]
method = "GET"
url = "{{base_url}}/users"

[assert]
status = 200

[assert.json."[0].team"]
equal = "alpha"

[assert.json."[1].team"]
equal = "alpha"

[assert.json."[2]"]
exists = false

users/get_beta_team.toml

name = "verify_overridden_params_beta"

[request]
method = "GET"
url = "{{base_url}}/users"

[params]
team = "beta"

[assert]
status = 200

[assert.json."[0].team"]
equal = "beta"

[assert.json."[1]"]
exists = false

Run

rumour run ./config_examples/03_inherited_params/users/ -v

Output

~/workspace/testing main ❯ rumour run ./config_examples/03_inherited_params/users/ -v
GET http://localhost:4000/api/v2/users
URL: http://localhost:4000/api/v2/users?team=alpha
Query Param: team=alpha
✓ SUCCESS: /home/bugsfounder/workspace/testing/config_examples/03_inherited_params/users/get_alpha_team.toml (2ms)
GET http://localhost:4000/api/v2/users
URL: http://localhost:4000/api/v2/users?team=beta
Query Param: team=beta
✓ SUCCESS: /home/bugsfounder/workspace/testing/config_examples/03_inherited_params/users/get_beta_team.toml (1ms)
✓ ./config_examples/03_inherited_params/users/ → PASS (2 Pass, 0 Fail, 0 Skip)
╭──────────────────────────────────────────────────────────────────────────╮
│ RUMOUR EXECUTION REPORT │
├──────────────────────────────────────────────────────────────────────────┤
│ Total Requests: 2
│ Successful: 2
│ Failed: 0
│ Skipped: 0
│ Success Rate: 100.0% │
│ Total Time: 3ms │
╰──────────────────────────────────────────────────────────────────────────╯

✓ Successful Requests:
- /home/bugsfounder/workspace/testing/config_examples/03_inherited_params/users/get_alpha_team.toml [200] [2ms]
- /home/bugsfounder/workspace/testing/config_examples/03_inherited_params/users/get_beta_team.toml [200] [1ms]

Actionable Recommendations:
→ Run with --json to export this report for your CI/CD pipeline.

Explanation

When the directory is executed, the team = "alpha" parameter from the api.config.toml is injected automatically into get_alpha_team.toml, appending ?team=alpha to the URL. However, get_beta_team.toml defines a local team = "beta" parameter which takes priority and overrides the inherited value, appending ?team=beta to its URL. This demonstrates how you can share defaults while easily overriding them when necessary.