Repository navigation
How can I always run a request when a collection is opened? #5719
|
I have an authentication request that generates a token valid for a few hours. I need to run this script just once every time I open the app/collection. In this authentication request, I have a post request script that sets the required secrets which all other scripts in the collection can use. Rather than spamming the server and generating a new token for every request (using pre request scripts), is there a way to have a script run only once (when bruno/this collection is opened)? |
Answered by
helloanoop
Oct 9, 2025
Replies: 2 comments
|
You can add a pre-request script on the collection level that checks if the Token is already set. If it's not set, you can use |
0 replies
|
You could also use bru.sendrequest() or bru.runRequest() as Timon mentioned |
0 replies
Answer selected by
vishalnandagopal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could also use bru.sendrequest() or bru.runRequest() as Timon mentioned