Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode Rest client - how to set variable to variable

Using VSCode Rest Client - How do you pass the value of a variable between variables?

@varA = “123”
@varB = “234”
@varFinal = varA

currently it doesn’t pass the value, it sets varFinal to the static string ‘varA’ - I want it to be ‘123’

like image 220
Marcus Avatar asked Sep 10 '19 15:09

Marcus


1 Answers

You have to include variable inside double bracket like "{{variableName}}". In the above scenario, you could change the expression as shown below

@varA = 123
@varB = 234
@varFinal = {{varA}}

In the below example, I am storing "swapi.co" in variable "host". Further I am assigning "host" variable to "host1" and using in my http request.

@host = swapi.co
@host1 = {{host}}

GET https://{{host1}}/api/planets/ HTTP/1.1
like image 192
Vinoth A Avatar answered Sep 28 '22 08:09

Vinoth A