gRPC Scripting API Support in Bruno (RFC) #6982
Replies: 2 comments 2 replies
-
|
Hi team, thanks for this. It's gonna be very useful. My use case is fairly simple. In my service (unary calls) I have 2 main things to do:
Your proposal covers way more than I personally need 😄 I just have a tiny question on status codes. How does the team plan to represent gRPC status codes in the scripting API? Will you stick to the standard 0-16 integer range? Or will you do any arbitrary mapping? Thank you so much for your commitment! |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for putting this together @sanish-bruno ! This would be a massive improvement.
It could be:
Also, onNext and onCompleted can be generated both server and client side, would it make sense to add the ability to add hooks on both? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
gRPC Scripting Support in Bruno (Early Preview)
We're actively working on gRPC scripting support in Bruno, and we'd love to get early feedback from the community.
Planned Scripting APIs
We plan to expose
reqandresobjects for gRPC, similar to HTTP, with support for both unary and streaming RPCs.Request APIs
req.methodPathreq.getMessage(index)req.getMessages()req.messages(property access, equivalent to req.getMessages())req.setMessage(index, data)req.addMessage(data)req.addMessages(data[])req.getMetadata(key)req.metadata(property access, get all metadata)req.hasMetadata(key)req.setMetadata(key, value)req.cancel()req.end()Response APIs
res.getMessage(index)res.getMessages()res.messages(property access, equivalent to res.getMessages(), gRPC body equivalent)res.getMetadata(key)res.metadata(property access, get all metadata)res.hasMetadata()(check if metadata exists)res.getTrailers(key)res.hasTrailers()(check if trailers exist)res.getStatus()(get gRPC status code)res.getStatusText()(get gRPC status text)res.responseTimeres.statusThese APIs are designed to work consistently across:
Event-based Hooks
Unlike HTTP requests which use pre-request and post-response scripts, gRPC requests will use an event-based Hooks system. This approach is better suited for gRPC's streaming nature and allows for more granular control over the request/response lifecycle.
Why event-based hooks for gRPC?
Hooks can be defined at:
Planned events include:
beforeInvoke- Called before the gRPC call is invoked (similar to pre-request)afterResponse- Called after the gRPC call completes (similar to post-response)onMessage- Called for each incoming message in streaming RPCs (server streaming, bidirectional)The API namespaces and exact hook signatures are yet to be finalized
We'd Love Your Feedback ❤️
If you use gRPC heavily or have experience with scripting in other tools, your input will help shape this feature.
Thanks for helping us build better gRPC support in Bruno! 🚀
Beta Was this translation helpful? Give feedback.
All reactions