File tree 2 files changed +5
-11
lines changed
src/Symfony/Component/HttpFoundation 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)
267
267
$ this ->setContent (null );
268
268
$ headers ->remove ('Content-Type ' );
269
269
$ headers ->remove ('Content-Length ' );
270
+ // prevent PHP from sending the Content-Type header based on default_mimetype
271
+ ini_set ('default_mimetype ' , '' );
270
272
} else {
271
273
// Content-type based on the Request
272
274
if (!$ headers ->has ('Content-Type ' )) {
273
- $ format = $ request ->getPreferredFormat ();
275
+ $ format = $ request ->getPreferredFormat (null );
274
276
if (null !== $ format && $ mimeType = $ request ->getMimeType ($ format )) {
275
277
$ headers ->set ('Content-Type ' , $ mimeType );
276
278
}
Original file line number Diff line number Diff line change @@ -461,18 +461,10 @@ public function testSetVary()
461
461
462
462
public function testDefaultContentType ()
463
463
{
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
-
472
464
$ response = new Response ('foo ' );
473
- $ response ->headers = $ headerMock ;
474
-
475
465
$ response ->prepare (new Request ());
466
+
467
+ $ this ->assertSame ('text/html; charset=UTF-8 ' , $ response ->headers ->get ('Content-Type ' ));
476
468
}
477
469
478
470
public function testContentTypeCharset ()
You can’t perform that action at this time.
0 commit comments