usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
21.54k stars 1.01k forks source link

[Feature Request] Change response body before showing it: res.setBody() #2441

Open marc0l92 opened 2 weeks ago

marc0l92 commented 2 weeks ago

I have checked the following:

Describe the feature you want to add

I have a service that replies in base64 and I would like to intercept and modify the response body in order to decode it before it gets display.

There is a way to read the response body from the post response script using the function res.getBody(), but there is nothing to set it (like we have in the request body).

Could it be possible to implement the res.setBody() in order to override the body message displayed in the response panel?

The workaround I'm currently using is to print the decoded response in the console using console.log, but it will be more clean to show it directly in the response panel