vscode-restclient
vscode-restclient copied to clipboard
Ability for Environment variables to reference Request variables
Hi have two environments "Local" and "Sandbox" but they don't use the same kind of authentication. "Local" is using basic authentication and "Sandbox" uses a bearer token.
Local
@myCredentials= XXXXXXXX
###
GET https://{{myHost}}/path/
Authorization: Basic {{myCredentials}}
Sandbox
@authToken = {{authenticationRequest.response.body.$.access_token}}
###
GET https://{{myHost}}/path/
Authorization: Bearer {{authToken}}
"myCredentials" is a constant value but "authToken" is a request variable.
I would like to combine these two request in one.
GET https://{{myHost}}/path/
Authorization: {{myAuth}}
I thought I would be able to define my environments like this but it doesn't work.
{
"rest-client.environmentVariables": {
"Local": {
"myAuth": "Basic XXXXXXXX"
},
"Sandbox": {
"myAuth": "Bearer {{authenticationRequest.response.body.$.access_token}}"
}
}
}
What would be the solution ?
We should also be able to reference a system variable :
{
"rest-client.environmentVariables": {
"Sandbox": {
"myAuth": "Bearer {{$aadV2Token appOnly}}"
}
}
}