Short Story
You have to have your environment variables set in the init value columns if you want the mock server to see them.
Long story
So, this took me a while to figure out why I couldnāt make the whole mock envās work ā¦ and as it makes sense once I thought about ā¦ I thought I would pass it along here so that others might not have the same issue I have
So, first off, I tend to not use the environment variables like others seem to I set all my environment variables that are ādynamicā through a pre-script in the āsetupā folder that I make for all my collections ā¦ there is a corresponding ātakedownā folder that removes all the stuff I did. For that reason, all most all my variables that are in ācurrentā set.
Issue
So ā¦ for the longest time I couldnāt get anything but the dynamic global variables like $randomBankAccount
or $randomUUID
to work.
The fix and reason for it
Then I read one of the posts about how they couldnāt figure out how to get the variables to not persist so that if a test were running twice then the variables would step on each other. That got me thinking along the right track and it ALL came clear ā¦ the current variables CANāT be shared with the mock server cause they arenāt serialized or stored on the postman servers.
If only
Thus, I am trying to figure out how to āforceā through code, the variables to the mock server so it can be used. Personally, I am still thinking that giving it ( the mock server instance ) access to headers is a simple and obvious thing to do is give something like: {{$header['the_header_you_want']}}
as a form of a global expand like the $random is.
Thoughts?