Add Content-Type for xml decoding

This commit is contained in:
Zach Borboa
2014-04-13 21:26:21 -07:00
parent c6352873a9
commit 2ef439f7e4
2 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -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)) {
+6
View File
@@ -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');