public function testParsingContentTypeWithEncoding() {
$response = new Response(array('headers' => array(
'Content-Type' => 'text/xml;charset=UTF-8'
)));
$this->assertEqual('text/xml', $response->type);
$this->assertEqual('UTF-8', $response->encoding);
$response = new Response(array('headers' => array(
'Content-Type' => 'application/soap+xml; charset=iso-8859-1'
)));
$this->assertEqual('application/soap+xml', $response->type);
$this->assertEqual('ISO-8859-1', $response->encoding);
// Content type WITHOUT space between type and charset
$response = new Response(array('headers' => array(
'Content-Type' => 'application/json;charset=iso-8859-1'
)));
$this->assertEqual('application/json', $response->type);
$this->assertEqual('ISO-8859-1', $response->encoding);
// Content type WITH ONE space between type and charset
$response = new Response(array('headers' => array(
'Content-Type' => 'application/json; charset=iso-8859-1'
)));
$this->assertEqual('application/json', $response->type);
$this->assertEqual('ISO-8859-1', $response->encoding);
$response = new Response(array('headers' => array(
'Content-Type' => 'application/json; charset=iso-8859-1'
)));
$this->assertEqual('application/json', $response->type);
$this->assertEqual('ISO-8859-1', $response->encoding);
}