Order of execution within a collection

Asanke Galgomuwa
Wed, 20 Nov 2024 00:28:56 +0000
Help Hub

In my Postman collection, I have the below structure

Collection
|-> Scripts --> Pre-Scripts -->pm.environment.set("AuthToken", "X");
|->Group folder
  |-> Sub folder
    |->request-1
      |-> Scripts --> Pre-request --> pm.environment.unset("AuthToken");
    |->Token generation request
      |->Scripts --> Post-Scripts  --> pm.environment.set("AuthToken", "Y");
    |->Reqest-2
      |->Headers --> Authorization:{{AuthToken}}

At this level I expect the “AuthToken” to be “Y”, but this is getting always the value of “X” Why is that and how to get this sorted?

7 posts - 3 participants