Corrupted Response when JSON value is a XML
contatolucascosta opened this issue · 0 comments
contatolucascosta commented
Hi.
I found a issue, when the value/content of attribute of the response (application/json) is a XML.
See this example, observe the attribute "route":
{
"id": "60495986e195c92f356e1b6f",
"applicationName": "api-onboarding-template",
"route": "<cole-aqui-o-seu-xml/>"
}
The problem is because the response captured of Httpful is:
{
"id":"60495986e195c92f356e1b6f",
"applicationName":"api-onboarding-template",
"route":""
}
See that content of attribute "route" was empty
My source code is:
$uri = "https://myendpoint...";
$response= \Httpful\Request::get($uri)
->addHeaders(array(
'X-Company-Id' => '01',
'X-Application-Id' => '01',
'X-User-Id' => '01',
'X-Trace-Id' => '01',
'Content-Type' => 'application/json'
,'Authorization' => $_SESSION['tokenType'].' '.$_SESSION['token']
))
->send();
echo "<br>$response->raw_body<br>";
Someone knows why it's happen this, and if it's possible to fix ?
Please!
Best regards.