Get Variables availble from functions to variables in the main yaml file #1008
Replies: 3 comments 4 replies
-
hi @Nadiush1993 👋 You can set a variable by assigning to function setVar(requestParams, response, context, ee, next) {
context.vars.requestId = 12345;
return next();
} used in a scenario: - get:
url: "/"
afterResponse: setVar # this will set requestId variable
- post:
url: "/{{requestId}}" # requestId variable is available now |
Beta Was this translation helpful? Give feedback.
-
I know this is an old topic but it is something I'm currently struggling with. How do I dynamically set a variable without it being hardcoded like the above example? |
Beta Was this translation helpful? Give feedback.
-
When I set my variable like below in my yml file
this part from my function actually picks up 'foo'
but I want to dynamically set this based on the url that my one api returns, so far no luck, I even tried using 'set' but 'redirectUrl' remains 'foo'
|
Beta Was this translation helpful? Give feedback.
-
Hello,
i am trying to calc in a request a specific IDs with using afterResponse function and after that continue with next request using those ID's i have calculated in a seperate js file.
how can i return those ID's or use them in the next request.
any ideas someone?
thanks!
Beta Was this translation helpful? Give feedback.
All reactions