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

[BUG]: Bruno's display of the response can be modified #3443

Open
2 tasks done
tho-gru-38 opened this issue Nov 7, 2024 · 2 comments
Open
2 tasks done

[BUG]: Bruno's display of the response can be modified #3443

tho-gru-38 opened this issue Nov 7, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@tho-gru-38
Copy link

I have checked the following:

  • I use the newest version of bruno.
  • I've searched existing issues and found nothing related to my issue.

Describe the bug

While using Bruno I expected that the response frame displays the response as it was received.

Today I learned that the contents of this frame can be modified by JavaScript:
image

As you can see above, the JavaScript code changes the displayed contents of the frame (marked green). When you delete the marked line of code in the tests section and rerun the request, the marked property will not be displayed anymore.

My expectation is that Bruno displays the response as it was received. This display should not be modifiable by any JavaScript code. Otherwise I can not see the truth about the response because it might be messed up by some code containing errors.

In summary: res.getBody() should return a deep copy of what is displayed in the response frame.

.bru file to reproduce the bug

meta {
  name: Modify response
  type: http
  seq: 6
}

get {
  url: https://jsonplaceholder.org/users
  body: none
  auth: none
}

tests {
  const jsonResponse = res.getBody();
  bru.setVar("resource_responseBody", jsonResponse);
  
  jsonResponse[0].insertedByScript = "test123-abc-def"; /* */
  
}

Screenshots/Live demo link

.

@tho-gru-38 tho-gru-38 added the bug Something isn't working label Nov 7, 2024
@tho-gru-38
Copy link
Author

I found the following workaround:

const lodash = require("lodash");
const jsonResponse = lodash.cloneDeep(res.getBody());
bru.setVar("resource_responseBody", jsonResponse);

In my opinion this deep copy should be done before returning the reference of the body to make sure that the display of Bruno always reflects the response.

@sreelakshmi-bruno sreelakshmi-bruno self-assigned this Nov 7, 2024
@sreelakshmi-bruno
Copy link
Collaborator

Hi @tho-gru-38, thanks for reporting this, we'll work this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants