Clearing Env Variables in Collection

In my collection, I have set and used the environment variables at in multiple steps. End the end of the iteration, I want to write down a “CleanUp” method that clears/unsets all the temp env variables.
What is the best way to achieve that?

Hey @nidhi27gupta

Thanks for your question :trophy:

I started a thread about some different things that I find useful when working in the application - One of the entries was around clearing out variables. There are also follow up ways to do this from other community members.

Hey @danny-dainton,
Thanks for your quick reply. I also need same sort of thing… clearing selective variables.
However, was wondering do we have any other place / way to put that code other that the last request of collection. As with time I may need to add more requests to my collection. Which means I will need to update the location of the cleanup method every time a new request is added to the collection.

You’re welcome! :slight_smile:

You could also try applying this to the Tests tab at either the Collection or Sub-Folder level, to save repeating yourself. Try and experiment with the different ways to suit your own context :slight_smile:

More information of keeping things DRY can be found here: