Setting an environment variable back to its default value

I sometimes change a variable in my pre-request script for a request

and then in my collection at the end of the collection-level tests I want to set it back. I am having to use a second variable to store the value.

pm.environment.set("maxErrors", pm.environment.get("maxErrorsDefault"));

what I really want to do is something like (pseudo-code)

pm.environment.resetToDefaultValue("maxErrors")

is there a way?

Hey @ButtockFlesh :wave:

I was going to suggest something like this method but I think you’re kinda doing this already:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.