Skip to content

#9268 TEXT body should interpolate variables - #9269

Open
Kanaduchi wants to merge 2 commits into
usebruno:mainfrom
Kanaduchi:9268-fix
Open

Kanaduchi wants to merge 2 commits into
usebruno:mainfrom
Kanaduchi:9268-fix

Conversation

@Kanaduchi

@Kanaduchi Kanaduchi commented Sep 15, 2026

Copy link
Copy Markdown

BRU-4556

TEXT body with Content-Type: application/x-www-form-urlencoded should interpolate variables

Problem

When a request uses Body type TEXT and the header Content-Type: application/x-www-form-urlencoded, variables in the body stay as literal {{var}} at send time.

The editor highlights them as resolved, and the URL interpolates correctly. Timeline shows the body was sent unresolved.

This is a possible regression of #2400 (closed as fixed in v1.35).

Root cause: urlencoded interpolation only runs when request.data is an array (Form URL Encoded fields). TEXT body is a string, so that branch does nothing. URL uses a different path, so it still interpolates.

Fix

Add interpolation if request.data is string

Screenshots

Before:
Screenshot 2026-09-15 at 15 33 56

After:
Final

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.
  • I've run the claude code review skill locally.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed variable interpolation for text-based application/x-www-form-urlencoded request bodies.
    • Ensured variables resolve correctly in URLs and form fields using environment or request-level variables.
    • Preserved form field names, enabled states, and values when interpolating array-based form data.
  • Tests

    • Added coverage for text and array-based form-urlencoded requests.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: d56ce3fd-6dab-4fa8-948a-d32d5013ff72

📥 Commits

Reviewing files that changed from the base of the PR and between f6714f2 and 435e75a.

📒 Files selected for processing (4)
  • packages/bruno-cli/src/runner/interpolate-vars.js
  • packages/bruno-cli/tests/runner/interpolate-vars.spec.js
  • packages/bruno-electron/src/ipc/network/interpolate-vars.js
  • packages/bruno-electron/tests/network/interpolate-vars.spec.js

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The change adds explicit interpolation for string form-urlencoded bodies in the CLI path and adds equivalent explicit handling in the Electron path. Tests cover environment variables, request-level global variables, and array-based form fields.

Changes

Form-urlencoded interpolation

Layer / File(s) Summary
Interpolation handling and coverage
packages/bruno-cli/src/runner/interpolate-vars.js, packages/bruno-cli/tests/runner/interpolate-vars.spec.js, packages/bruno-electron/src/ipc/network/interpolate-vars.js, packages/bruno-electron/tests/network/interpolate-vars.spec.js
The CLI path interpolates string form-urlencoded bodies. The Electron path adds an explicit string branch with unchanged observable behavior. Tests cover URL and body variables from both environment sources, plus array-based fields with preserved names and enabled flags.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 945b5

Form-urlencoded text bodies retain variable interpolation across the CLI and Electron paths, with no actionable merge risk identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: variable interpolation for TEXT request bodies. It is specific and directly related to the pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Form fields wake in a string of light
URL tokens resolve just right
Global values join the flow
Enabled flags stay in tow
Tests record the polished route

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant