瀏覽代碼

added text/html to default format mapping

Lukas Kahwe Smith 14 年之前
父節點
當前提交
c2ac8304b0

+ 1 - 0
src/Symfony/Component/HttpFoundation/Request.php

@@ -974,6 +974,7 @@ class Request
     static protected function initializeFormats()
     {
         static::$formats = array(
+            'html' => array('text/html', 'application/xhtml+xml'),
             'txt'  => array('text/plain'),
             'js'   => array('application/javascript', 'application/x-javascript', 'text/javascript'),
             'css'  => array('text/css'),

+ 1 - 1
tests/Symfony/Tests/Component/HttpKernel/ResponseListenerTest.php

@@ -62,7 +62,7 @@ class ResponseListenerTest extends \PHPUnit_Framework_TestCase
         $event = new FilterResponseEvent($this->kernel, Request::create('/'), HttpKernelInterface::MASTER_REQUEST, $response);
         $this->dispatcher->dispatch(Events::onCoreResponse, $event);
 
-        $this->assertEquals('', $event->getResponse()->headers->get('content-type'));
+        $this->assertEquals('text/html', $event->getResponse()->headers->get('content-type'));
     }
 
     public function testFilterSetContentType()