-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Pre-request variables are not being interpolated within request body when running tests via CLI #2871
Comments
Same here and also Vars from Pre Request are now (it was working before 1.20) not accessible in Pre Request Script.
Related: #2759 Fixed: replace Just need to update the doc: https://docs.usebruno.com/scripting/javascript-reference#collection-variables and everything will be clear ;) |
I'm having the same issue. I noticed that the bruno/packages/bruno-cli/src/runner/interpolate-vars.js Lines 16 to 18 in ac67c4c
bruno/packages/bruno-electron/src/ipc/network/interpolate-vars.js Lines 16 to 22 in ac67c4c
|
This is definitely still an issue in the bruno-cli runner. Requests and tests work fine in the electron app. As @HenriqueRech pointed out. The interpolate-vars.js was modified with @lohxt1 's fix for multipart form data variables but doesn't look like those changes also made their way into the cli. |
I'm not using cli but the electron app and notice that variables set in pre request |
I have checked the following:
Describe the bug
When running tests via CLI if pre-request variables used within the request body(json) never get interpolated and are submitted as such
{{some_variable}}
in your request.This does not happen within the bruno the app this ONLY happens when running test via bruno CLI
Might be slightly related to...
Issues:
PRs:
Environment
.bru file to reproduce the bug
No response
Screenshots/Live demo link
Create a test and set some vars
Use them with in the body
Define some assertions using those variables
Every tests using those variables will fail
Instead of the variable values being sent with the request the template literal is what ends up being saved (in my create example anyway)
By the time assertions are run the variable are working properly again but whats returned as the response will be wrong since the string literal was saved and not it's value.
Currently I'm working around this with this script in my collection so its run with every request
The text was updated successfully, but these errors were encountered: