mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 20:20:53 +00:00
Add Content-Type for xml decoding
This commit is contained in:
+2
-1
@@ -350,7 +350,8 @@ class Curl
|
||||
if (!is_null($json_obj)) {
|
||||
$ch->response = $json_obj;
|
||||
}
|
||||
} elseif (preg_match('/^application\/xml/i', $ch->response_headers['Content-Type']) ||
|
||||
} elseif (preg_match('/^application\/rss\+xml/i', $ch->response_headers['Content-Type']) ||
|
||||
preg_match('/^application\/xml/i', $ch->response_headers['Content-Type']) ||
|
||||
preg_match('/^text\/xml/i', $ch->response_headers['Content-Type'])) {
|
||||
$xml_obj = @simplexml_load_string($ch->response);
|
||||
if (!($xml_obj === false)) {
|
||||
|
||||
@@ -432,6 +432,12 @@ class CurlTest extends PHPUnit_Framework_TestCase {
|
||||
PHPUnit_Framework_Assert::assertInstanceOf('SimpleXMLElement', $test->curl->response);
|
||||
}
|
||||
|
||||
xml_assertion('Content-Type', 'application/rss+xml; charset=utf-8');
|
||||
xml_assertion('content-type', 'application/rss+xml; charset=utf-8');
|
||||
xml_assertion('Content-Type', 'application/rss+xml');
|
||||
xml_assertion('content-type', 'application/rss+xml');
|
||||
xml_assertion('CONTENT-TYPE', 'application/rss+xml');
|
||||
xml_assertion('CONTENT-TYPE', 'application/rss+xml');
|
||||
xml_assertion('Content-Type', 'application/xml; charset=utf-8');
|
||||
xml_assertion('content-type', 'application/xml; charset=utf-8');
|
||||
xml_assertion('Content-Type', 'application/xml');
|
||||
|
||||
Reference in New Issue
Block a user