usebruno / bruno

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

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

Open That-1-QA opened 4 weeks ago

That-1-QA commented 4 weeks ago

I have checked the following:

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

helloanoop commented 2 weeks ago

This should be fixed when we support yaml based storage format in Bruno.

helloanoop commented 4 days ago

While we wait for yaml lang support to be finished, I think supporting escape might be a good idea.