Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String Interpolation of Request Variables broken in v1.28.0 and later releases #3148

Open
2 tasks done
AaronPatterson opened this issue Sep 19, 2024 · 3 comments
Open
2 tasks done
Assignees
Labels

Comments

@AaronPatterson
Copy link

I have checked the following:

  • I use the newest version of bruno.
  • I've searched existing issues and found nothing related to my issue.

Describe the bug

In v1.27.0 and earlier releases string interpolation was done on request variables. This has stopped working in release 1.28.0 and later.

String interpolation of the request variables was nice and allowed for variables to be picked up from the Environment and easily overridden on individual requests as need.

Example:
SampleEnvironment.bru

vars {
  TestVar: TestVarFromEnvironment
}

SampleRequest.bru

meta {
  name: RequestVariableInterpolation
  type: http
  seq: 1
}

get {
  url: https://localhost/{{TestVar}}
  body: none
  auth: none
}

vars:pre-request {
  TestVar: ${TestVar}
}

v1.27.0 outbound request: GET https://localhost/TestVarFromEnvironment
v1.28.0 oubtound request: GET https://localhost/${TestVar}

This could be related to commit: cb395e7

In this the following code was removed form run-single-request.js

    // run pre-request vars
    const preRequestVars = get(bruJson, 'request.vars.req');
    if (preRequestVars?.length) {
      const varsRuntime = new VarsRuntime({ runtime: scriptingConfig?.runtime });
      varsRuntime.runPreRequestVars(
        preRequestVars,
        request,
        envVariables,
        runtimeVariables,
        collectionPath,
        processEnvVars
      );
    }

.bru file to reproduce the bug

meta {
name: RequestVariableInterpolation
type: http
seq: 1
}

get {
url: https://localhost/{{TestVar}}
body: none
auth: none
}

vars:pre-request {
TestVar: ${TestVar}
}

Screenshots/Live demo link

image

@AaronPatterson AaronPatterson added the bug Something isn't working label Sep 19, 2024
@johan-lejdung
Copy link

johan-lejdung commented Oct 10, 2024

Is there any work done on this issue? This issue and #2557 is currently stopping us from upgrading to anything later than v18....

@sreelakshmi-bruno sreelakshmi-bruno self-assigned this Nov 12, 2024
@helloanoop
Copy link
Contributor

@AaronPatterson @johan-lejdung

You should still be able to use interpolate using {{}} syntax in pre-request vars.
Instead of ${TestVar}, replace it with {{TestVar}}

@AaronPatterson @johan-lejdung Can you check if this resolves your issue using the latest version of Bruno (v1.34.2)

@AaronPatterson
Copy link
Author

I tried this with v1.34.2 and the {{TestVar}} syntax yielded the same results when used in a Pre-Request Variable. The strings were not interpolated and the value from in the Variable was used directly ({{TestVar}}).

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants