Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow scripts to call requests before similar to setNextRequest() #3949

Closed
1 task done
Kazuto opened this issue Feb 5, 2025 · 4 comments
Closed
1 task done

Allow scripts to call requests before similar to setNextRequest() #3949

Kazuto opened this issue Feb 5, 2025 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@Kazuto
Copy link

Kazuto commented Feb 5, 2025

I have checked the following:

  • I've searched existing issues and found nothing related to my issue.

Describe the feature you want to add

API are often secured with authentication that will expire after a certain time. Especially during development having to reauthenticate locally is an annoyance and clients like Postman or Insomnia solved this by allowing the user to run requests before the current request.

And yes, I know that I could just do a fetch in the collection's pre-request script but having an documented auth endpoint is the proper way to handle authentication than a script hidden in the collection.

End of 2023 setNextRequest() with #619 was implemented and I can't understand why something like bru.setPrevRequest() or a simple bru.call() has not been implemented as sending requests before the actual request is a basic feature other clients have.

If I can set a request to run after the current request I should also be able to run a request before the current request.

Mockups or Images of the feature

No mockups needed.

Just like setPrevRequest() but for executing requests before the main request.

@Kazuto Kazuto added the enhancement New feature or request label Feb 5, 2025
@Kazuto Kazuto changed the title Allow endpoints to call requests before like setNextRequest() Allow endpoints to call requests before similar to setNextRequest() Feb 5, 2025
@Kazuto Kazuto changed the title Allow endpoints to call requests before similar to setNextRequest() Allow scripts to call requests before similar to setNextRequest() Feb 5, 2025
@anusree-bruno anusree-bruno self-assigned this Feb 6, 2025
@anusree-bruno
Copy link
Collaborator

anusree-bruno commented Feb 6, 2025

Hi @Kazuto

To run a request already created in the collection, you can use the runRequest API in the pre-request script to call the auth API.

Image

The runRequest API had an issue, which we have fixed in our current nightly build. This update will be released by next week.

Reference: Documentation

@Kazuto
Copy link
Author

Kazuto commented Feb 6, 2025

Hi @Kazuto

To run a request already created in the collection, you can use the runRequest API in the pre-request script to call the auth API.

Image

The runRequest API had an issue, which we have fixed in our current nightly build. This update will be released by next week.

Reference: Documentation

Hi @anusree-bruno

Thanks for the reply. The function was not shown to me in the autocompletion but I'll give it a try :)

@anusree-bruno
Copy link
Collaborator

Hi @Kazuto

Thanks for pointing that out, we’ll get it fixed..

@Kazuto
Copy link
Author

Kazuto commented Feb 6, 2025

It works as intended. Thanks for the help :)

@Kazuto Kazuto closed this as completed Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants