Can someone check if this is a visual studio error or if I made a mistake somewhere?
Desired scenario: first request in each of .http files is login request.
Other requests consume the token from the login request variable.
http-client.env.json:
{
"$shared": {
"login": "<login>",
"pass": "<pass>"
},
"local": {
"host": "<url:localhost>"
},
"dev": {
"host": "<url:dev>"
}
}
MyRequests.http:
### Run Login before next queries.
// @name login
POST {{host}}/api/auth/login HTTP/1.1
Content-Type: application/json
{
"Login": "{{login}}",
"Password": "{{pass}}"
}
###
GET {{host}}/api/todos
Authorization: Bearer {{login.response.body.$.token}}
Error:
(2,25): error HTTP0012: Unable to evaluate expression 'login.response.body.$.token'.
Everything works if I use constants directly in the .http file for login-password instead of environment variables.
In general, the goal is to store the login and password in a separate file that is not under source control.