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

Incorrect JSON response from XML body request #2294

Open
2 tasks done
jjaimes opened this issue May 12, 2024 · 1 comment
Open
2 tasks done

Incorrect JSON response from XML body request #2294

jjaimes opened this issue May 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jjaimes
Copy link

jjaimes commented May 12, 2024

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

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

@jjaimes jjaimes added the bug Something isn't working label May 12, 2024
@jjaimes jjaimes changed the title wrong JSON response from XML body request Incorrect JSON response from XML body request May 12, 2024
@Its-treason
Copy link
Member

Its-treason commented May 12, 2024

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

We probably need to add a raw response viewer.

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