bruno icon indicating copy to clipboard operation
bruno copied to clipboard

Unable to use the Asserts tab for assertions on JSON response body for properties with names that contain ":" characters

Open That-1-QA opened this issue 1 year ago • 0 comments

I have checked the following:

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

Describe the bug

Any valid string is allowed as a name for a JSON property, even strings containing quote characters assuming they are properly escaped. In the case of properties that contain the ":" character, Bruno is unable to handle these correctly when using the Assert tab.

Assuming we have a response body with the following JSON

{ "_embedded": { "otv:get_viewers": [ "brava-view-1.x", "iv-view-1.x" ] } }

You can enter in the following assert: image

The asserts work fine, up until the point at which you save the request. After saving it, they break and appear like the following: image

I've tried escaping the : character, but it doesn't change anything.

.bru file to reproduce the bug

meta { name: Viewers type: http seq: 1 }

get { url: {{viewer-service-origin}} body: none auth: none }

assert { res.status: eq 200 res.body._embedded["otv:get_viewers"]: contains "brava-view-1.x" }

Screenshots/Live demo link

image

That-1-QA avatar Oct 02 '24 15:10 That-1-QA