fix: variables not interpolated in form URL encoded bodies#61
Open
chirag-bruno wants to merge 1 commit into
Open
fix: variables not interpolated in form URL encoded bodies#61chirag-bruno wants to merge 1 commit into
chirag-bruno wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buildFormUrlEncodedPayloadcalls that URL-encoded{{variable}}templates before interpolation could resolve theminterpolate-vars.spec.tswith 8 tests including regression guardsProblem
Variables (
{{MY_VAR}}) in Form URL Encoded request bodies were sent as literal strings instead of resolved values. JSON bodies worked fine.Root Cause
buildFormUrlEncodedPayloadwas called beforeinterpolateVars, URL-encoding{{MY_VAR}}into%7B%7BMY_VAR%7D%7D— which the interpolation engine couldn't recognize. The correct encoding already existed insideexecuteRequest(after interpolation), matching the main Bruno repo's flow.Test plan
interpolate-vars.spec.tswith regression guards proving pre-encoded strings can't be interpolatednpm run test){{env_var}}values and verify they resolveCloses #58