We can include a Pre-Request Script to set the order of execution of requests within a Collection. A Pre-Request Script can also handle a scenario in which a value yielded from the request one has to be fed to the next request or the value yielded from the request one has to be processed before moving to the next request.
A Pre-Request can also be utilized to set a value from the Response field to a variable linked to a script in the Tests tab. These scripts are defined in the Pre-request Script tab in Postman.
console.log("This is a Postman Tutorial in Tutorialspoint")
Select a GET request and enter an endpoint then click on Send.
Postman Console Output:
Step1 − Click on the three dots beside a Collection in the sidebar. Then click on Edit.
Step2 − EDIT COLLECTION pop-up comes up. Click on the Pre-Request Scripts tab to add a pre-condition script. Then click on Update.