File tree Expand file tree Collapse file tree 2 files changed +5
-11
lines changed
src/Symfony/Component/HttpFoundation Expand file tree Collapse file tree 2 files changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -267,10 +267,12 @@ public function prepare(Request $request)
267267 $ this ->setContent (null );
268268 $ headers ->remove ('Content-Type ' );
269269 $ headers ->remove ('Content-Length ' );
270+ // prevent PHP from sending the Content-Type header based on default_mimetype
271+ ini_set ('default_mimetype ' , '' );
270272 } else {
271273 // Content-type based on the Request
272274 if (!$ headers ->has ('Content-Type ' )) {
273- $ format = $ request ->getPreferredFormat ();
275+ $ format = $ request ->getPreferredFormat (null );
274276 if (null !== $ format && $ mimeType = $ request ->getMimeType ($ format )) {
275277 $ headers ->set ('Content-Type ' , $ mimeType );
276278 }
Original file line number Diff line number Diff line change @@ -461,18 +461,10 @@ public function testSetVary()
461461
462462 public function testDefaultContentType ()
463463 {
464- $ headerMock = $ this ->getMockBuilder ('Symfony\Component\HttpFoundation\ResponseHeaderBag ' )->setMethods (['set ' ])->getMock ();
465- $ headerMock ->expects ($ this ->at (0 ))
466- ->method ('set ' )
467- ->with ('Content-Type ' , 'text/html ' );
468- $ headerMock ->expects ($ this ->at (1 ))
469- ->method ('set ' )
470- ->with ('Content-Type ' , 'text/html; charset=UTF-8 ' );
471-
472464 $ response = new Response ('foo ' );
473- $ response ->headers = $ headerMock ;
474-
475465 $ response ->prepare (new Request ());
466+
467+ $ this ->assertSame ('text/html; charset=UTF-8 ' , $ response ->headers ->get ('Content-Type ' ));
476468 }
477469
478470 public function testContentTypeCharset ()
You can’t perform that action at this time.
0 commit comments