-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: support for sendRequest functionality #3845
base: main
Are you sure you want to change the base?
feat: support for sendRequest functionality #3845
Conversation
@@ -153,6 +155,63 @@ class Bru { | |||
sleep(ms) { | |||
return new Promise((resolve) => setTimeout(resolve, ms)); | |||
} | |||
|
|||
sendRequest(requestConfig, callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to send the request and pass a specific variable to be used in either the pre
or post
scripts?
For instance, I'd like to call bru.sendRequest('./items/delete-item', { itemId: myCustomItemId })
. This would allow developers to customize further their scripts by replacing "request-scoped" variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thiagomini Bruno provides an API, bruno.runRequest('items/delete-item')
, to trigger another request already defined in Bruno.
The sendRequest()
API, on the other hand, is used for making direct HTTP requests.
It seems logical to support passing variables when using sendRequest()
. Could you please create a new GitHub issue outlining this requirement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see @helloanoop , thanks for the info! So, my idea is actually related to passing variables using the bruno.runRequest
, do we have that? If not, I'll create an issue asking for that feature
Looks great! Just curious, shouldn't the proxy be applied to the sendRequest as well? |
Description
This PR introduces support for the
sendRequest
function, enhancing the framework's ability to handle HTTP requests dynamically. The implementation supports multiple HTTP methods (GET
,POST
,PUT
,PATCH
,DELETE
) and allows Callback-based execution.Key Changes:
sendRequest
function with support for:Contribution Checklist: