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

Corrupted Response when JSON value is a XML #292

Open
contatolucascosta opened this issue Mar 11, 2021 · 0 comments
Open

Corrupted Response when JSON value is a XML #292

contatolucascosta opened this issue Mar 11, 2021 · 0 comments

Comments

@contatolucascosta
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant