Replies: 2 comments 4 replies
-
For these kind of computations, using scripts might be the perfect fit. Can you try if this fits your needs? |
Beta Was this translation helpful? Give feedback.
2 replies
-
Implemented in v4.2.0: @ENV_USER = some_username
@ENV_PROJECT = project_name
POST https://httpbin.org/post HTTP/1.1
Content-Type: application/json
Accept: application/json
{
"project": "{{ENV_PROJECT}}",
"results": [
{
"id": 1,
"desc": "some_username"
},
{
"id": 2,
"desc": "another_username"
}
]
}
> {%
client.global.set("AID", response.body.json.results.filter(item => item.desc === request.environment.get("ENV_USER"))[0].id);
%}
###
POST https://httpbin.org/post HTTP/1.1
Content-Type: application/json
Accept: application/json
{
"id": "{{AID}}"
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Would it make sense to make it possible to use variables within variable statements like the following, thus making it possible to put them into env files or imilar which would make it even more flexible?
Beta Was this translation helpful? Give feedback.
All reactions