Skip to content

fix: variables not interpolated in form URL encoded bodies#61

Open
chirag-bruno wants to merge 1 commit into
usebruno:mainfrom
chirag-bruno:fix/form-url-encoded-interpolation
Open

fix: variables not interpolated in form URL encoded bodies#61
chirag-bruno wants to merge 1 commit into
usebruno:mainfrom
chirag-bruno:fix/form-url-encoded-interpolation

Conversation

@chirag-bruno
Copy link
Copy Markdown
Collaborator

Summary

  • Remove premature buildFormUrlEncodedPayload calls that URL-encoded {{variable}} templates before interpolation could resolve them
  • Add interpolate-vars.spec.ts with 8 tests including regression guards

Problem

Variables ({{MY_VAR}}) in Form URL Encoded request bodies were sent as literal strings instead of resolved values. JSON bodies worked fine.

Root Cause

buildFormUrlEncodedPayload was called before interpolateVars, URL-encoding {{MY_VAR}} into %7B%7BMY_VAR%7D%7D — which the interpolation engine couldn't recognize. The correct encoding already existed inside executeRequest (after interpolation), matching the main Bruno repo's flow.

Test plan

  • Added interpolate-vars.spec.ts with regression guards proving pre-encoded strings can't be interpolated
  • All 8 tests pass (npm run test)
  • TypeScript typecheck passes
  • Manual test: create a form URL encoded request with {{env_var}} values and verify they resolve

Closes #58

The formUrlEncoded request data was being URL-encoded via
buildFormUrlEncodedPayload BEFORE variable interpolation ran, causing
template variables like {{MY_VAR}} to become %7B%7BMY_VAR%7D%7D which
the interpolation engine could not recognize.

Remove all premature buildFormUrlEncodedPayload calls that happened
before executeRequest. The encoding already happens correctly inside
executeRequest, after interpolateVars resolves all variables — matching
the order of operations in the main Bruno repository.

Closes usebruno#58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.env variables are not interpolated in Form URL Encoded bodies

2 participants