usebruno / bruno

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

Incorrect JSON response from XML body request #2294

Open jjaimes opened 6 months ago

jjaimes commented 6 months ago

I have checked the following:

Describe the bug

INPUT: this xml body:

<?xml version='1.0' encoding='UTF-8'?>
<MT_Customer>
    <row>
        <CustomerID>DJAIMES</CustomerID>
        <Country>Venezuela</Country>
    </row>
    <row>
        <CustomerID>JJAIMES</CustomerID>
        <Country>Chile</Country>
    </row>
</MT_Customer>

INCORRECT RESPONSE:

{
  "row": {
    "CustomerID": "JJAIMES",
    "Country": "Chile"
  }
}

CORRECT RESPONSE MUST BE:

{
  "row": {
    "CustomerID": "DJAIMES",
    "Country": "Venezuela"
  },
  "row": {
    "CustomerID": "JJAIMES",
    "Country": "Chile"
  }
}

.bru file to reproduce the bug

meta {
  name: 02-Convert_XML_to_JSON
  type: http
  seq: 3
}

get {
  url: https://{{sap_url}}/http/convert_xml_to_json
  body: xml
  auth: basic
}

headers {
  Content-Type: application/xml
}

auth:basic {
  username: {{clientId}}
  password: {{clientSecret}}
}

body:xml {
  <?xml version='1.0' encoding='UTF-8'?>
  <MT_Customer>
      <row>
          <CustomerID>DJAIMES</CustomerID>
          <Country>Venezuela</Country>
      </row>
      <row>
          <CustomerID>JJAIMES</CustomerID>
          <Country>Chile</Country>
      </row>
  </MT_Customer>
}

Screenshots/Live demo link

The RESPONSE (file: 01_incorrect_response_bruno.jpeg) has been compared with 2 tools:

  1. Visual Studio Code (Rest client) - (file: 01_correct_response_VSC.jpeg)
  2. APIDOG (file: 01_correct_response_APIDOG.jpeg)

(I hate POSTMAN 😁)

BRUNO RESPONSE (INCORRECT response) 01_incorrect_response_bruno

VISUAL STUDIO CODE RESPONSE (CORRECT response) 01_correct_response_VSC

APIDOG RESPONSE (CORRECT response) 01_correct_response_APIDOG

Its-treason commented 6 months ago

Bruno will automatically parse JSON in response. Because of this duplicate keys are removed.

We probably need to add a raw response viewer.

BharathBeeky commented 1 week ago

The Bruno is able to give Json response correctly as mentioned above when I am trying to replicate the issue. Please find the attached screen shot and kindly please share the commit details if this issue is fixed. Issue_2294