Decode atom+xml responses seamlessly

This commit is contained in:
Zach Borboa
2014-05-18 01:16:37 -07:00
parent e632e1b4af
commit 34742ee9e2
2 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -309,7 +309,8 @@ class Curl
if (!is_null($json_obj)) {
$response = $json_obj;
}
} elseif (preg_match('/^application\/rss\+xml/i', $response_headers['Content-Type']) ||
} elseif (preg_match('/^application\/atom\+xml/i', $response_headers['Content-Type']) ||
preg_match('/^application\/rss\+xml/i', $response_headers['Content-Type']) ||
preg_match('/^application\/xml/i', $response_headers['Content-Type']) ||
preg_match('/^text\/xml/i', $response_headers['Content-Type'])) {
$xml_obj = @simplexml_load_string($response);
+6
View File
@@ -574,6 +574,8 @@ class CurlTest extends PHPUnit_Framework_TestCase
PHPUnit_Framework_Assert::assertInstanceOf('SimpleXMLElement', $test->curl->response);
}
xmlAssertion('Content-Type', 'application/atom+xml; charset=UTF-8');
xmlAssertion('Content-Type', 'application/atom+xml;charset=UTF-8');
xmlAssertion('Content-Type', 'application/rss+xml');
xmlAssertion('Content-Type', 'application/rss+xml; charset=utf-8');
xmlAssertion('Content-Type', 'application/rss+xml;charset=utf-8');
@@ -584,6 +586,8 @@ class CurlTest extends PHPUnit_Framework_TestCase
xmlAssertion('Content-Type', 'text/xml; charset=utf-8');
xmlAssertion('Content-Type', 'text/xml;charset=utf-8');
xmlAssertion('content-type', 'application/atom+xml; charset=UTF-8');
xmlAssertion('content-type', 'application/atom+xml;charset=UTF-8');
xmlAssertion('content-type', 'application/rss+xml');
xmlAssertion('content-type', 'application/rss+xml; charset=utf-8');
xmlAssertion('content-type', 'application/rss+xml;charset=utf-8');
@@ -594,6 +598,8 @@ class CurlTest extends PHPUnit_Framework_TestCase
xmlAssertion('content-type', 'text/xml; charset=utf-8');
xmlAssertion('content-type', 'text/xml;charset=utf-8');
xmlAssertion('CONTENT-TYPE', 'application/atom+xml; charset=UTF-8');
xmlAssertion('CONTENT-TYPE', 'application/atom+xml;charset=UTF-8');
xmlAssertion('CONTENT-TYPE', 'application/rss+xml');
xmlAssertion('CONTENT-TYPE', 'application/rss+xml; charset=utf-8');
xmlAssertion('CONTENT-TYPE', 'application/rss+xml;charset=utf-8');