I am currently experiencing an issue with environment variable resolution within a pre-request script in Postman. Here are the details of the problem:
Description: I have set up an environment variable named organization_url
, with an initial value of {{base_url}}/organizations
. When I use this variable in a request URL, the value resolves correctly. However, when I attempt to retrieve the value of organization_url
within a pre-request script using pm.variables.get("organization_url")
, it does not return the resolved value; instead, it returns “{{base_url}}/organizations.”
Steps I’ve Taken:
- Ensured that the variable name in the script matches the name in the environment (
organization_url
). - Confirmed that I am running the request within the correct environment.
- Verified that the environment variable’s value is correctly set to
{{base_url}}/organizations
. - Attempted to use a different variable name in the script (
test_variable
) with the same value to isolate the issue, and encountered the same problem.
Expected Behavior: I expect the pre-request script to retrieve the resolved value of organization_url
, which should be https://test-api.teamplay.studio/organizations
.
Actual Behavior: The pre-request script currently returns “{{base_url}}/organizations” instead of the resolved value.
I would greatly appreciate your assistance in resolving this issue. Please let me know if you need any further information or if there are any troubleshooting steps I should follow.