bruno icon indicating copy to clipboard operation
bruno copied to clipboard

Regression: Double-{} wrapped VARS no longer resolved in scripts

Open mrhrzg opened this issue 1 year ago • 4 comments

I have checked the following:

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

Describe the bug

Where this came up: It was possible to extract a sub-string from the value saved in an environment dependent environmental variable (saved in the .env file).

Breakage: Now if I use define a Pre Request Var in the VARS tab and load it in my Script: const cookie = bru.getVar('Cookie'); then it is no longer resolved: console.log({cookie}); returns {{cookie}}, where it used to return the value of the cookie env var, which I could work with in the script.

.bru file to reproduce the bug

const envvar1 = bru.getVar('ev1');

console.log({envvar1});

req.setHeader("test", envvar1); console.log(req.headers);

Screenshots/Live demo link

Screenshot 2024-04-19 at 12 02 01

mrhrzg avatar Apr 19 '24 10:04 mrhrzg

That works for me unless I am missing something.

https://github.com/usebruno/bruno/assets/139650490/d9002275-a9bb-41f2-834d-b160e8bb96e3

end3rbyte avatar Apr 25 '24 13:04 end3rbyte

@busy-panda What you tried misses the part that broke: The requests Vars can refer to environmental variables. Those are not resolved any more.

https://github.com/usebruno/bruno/assets/36134546/b69b2445-bc09-42c1-9f09-97d6a684b32d

image

mrhrzg avatar Apr 26 '24 08:04 mrhrzg

I am checking, but why you don't retrieve directly from environment variable, instead of retrieve a variable that retrieve an environment variable ?

end3rbyte avatar Apr 30 '24 15:04 end3rbyte

It's working now, when the PR is merged. Cheers.

end3rbyte avatar May 01 '24 07:05 end3rbyte

Closing this because the PR implementing the fix has already been merged.

sanjai0py avatar Jul 10 '24 11:07 sanjai0py