mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-26 22:59:22 +00:00
Decode atom+xml responses seamlessly
This commit is contained in:
+2
-1
@@ -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);
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user