diff --git a/src/Http/Response.php b/src/Http/Response.php index 4ff8219c9ee..a45c8a35371 100644 --- a/src/Http/Response.php +++ b/src/Http/Response.php @@ -581,7 +581,7 @@ protected function _setContentType() return; } $whitelist = [ - 'application/javascript', 'application/json', 'application/xml', 'application/rss+xml' + 'application/javascript', 'application/xml', 'application/rss+xml' ]; $charset = false; diff --git a/tests/TestCase/Http/ResponseTest.php b/tests/TestCase/Http/ResponseTest.php index 1a48169a6b4..7064e08f241 100644 --- a/tests/TestCase/Http/ResponseTest.php +++ b/tests/TestCase/Http/ResponseTest.php @@ -315,7 +315,7 @@ public function testWithTypeAlias() ); $this->assertSame('application/pdf', $new->getHeaderLine('Content-Type')); $this->assertSame( - 'application/json; charset=UTF-8', + 'application/json', $new->withType('json')->getHeaderLine('Content-Type') ); } @@ -463,7 +463,6 @@ public static function charsetTypeProvider() return [ ['mp3', 'audio/mpeg'], ['js', 'application/javascript; charset=UTF-8'], - ['json', 'application/json; charset=UTF-8'], ['xml', 'application/xml; charset=UTF-8'], ['txt', 'text/plain; charset=UTF-8'], ]; diff --git a/tests/TestCase/Http/ResponseTransformerTest.php b/tests/TestCase/Http/ResponseTransformerTest.php index 84303527d01..504ae7bb96b 100644 --- a/tests/TestCase/Http/ResponseTransformerTest.php +++ b/tests/TestCase/Http/ResponseTransformerTest.php @@ -301,10 +301,6 @@ public function testToPsrContentTypeCharsetIsTypeSpecific() $cake->type('application/octet-stream'); $result = ResponseTransformer::toPsr($cake); $this->assertSame('application/octet-stream', $result->getHeaderLine('Content-Type')); - - $cake->type('application/json'); - $result = ResponseTransformer::toPsr($cake); - $this->assertSame('application/json; charset=utf-8', $result->getHeaderLine('Content-Type')); } /**