How can I access http-client.env.json variables in HTTP client script

Answered

How can I access variables that are defined in http-client.env.json within the scripts (HTTP Response handler)?

Example:

my http-client.env.json could be:

{
"dev": {
"name": "value"
}
}

I would like to access the value within the scripts (e.g. to ensure that the value that I passed into the request is contained in the response), but I didn't find any possibilities in the documentation and by "trial and error" on how to do that.

It would be possible to use the global variable store like that:

client.global.set("name", "value")
client.log(client.global.get("name"))

But then I would have to ensure that the variables are correctly initialized by another script beforehand. The configuration file is much more comfortable for such cases.

3
2 comments

This would be a great feature to have.  I hope that it gets implemented soon.

0

Please sign in to leave a comment.