thunder-client-support icon indicating copy to clipboard operation
thunder-client-support copied to clipboard

tc.getVar(...) returns a different value than the value previously set with tc.setVar(...)

Open checkerix opened this issue 1 year ago • 1 comments

Describe the bug

  • If a variable is defined twice (with the same name) in an environment, TC writes to the first variable but reads from the last variable.

To Reproduce

  • variable "variable1" is defined twice in the Local Env

image

  • in an inline script of a request, a value is set for this variable: tc.setVar("variable1", "correct_value", "local");
  • in a subsequent request, the value of {{variable1}} should be used

Observed behavior

  • {{variable1}} contains "wrong_value"

Expected behavior

  • {{variable1}} should contain "correct_value"

Platform:

  • OS: Windows 10
  • vscode version: 1.90.1
  • node version: 20.9.0
  • extension version: v2.24.0

Are you using the free version/paid version/trial:

  • paid version

checkerix avatar Jun 19 '24 17:06 checkerix