diff --git a/core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php index ac48bc80a04f2da1e5fcbe5df893746c9a743cd6..fa4be988322e9e3886e3e07f7b5e58dce103f277 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php @@ -59,7 +59,7 @@ public function onView(GetResponseForControllerResultEvent $event) { $event->setResponse($this->$method($event)); } else { - $event->setResponse(new Response('Unsupported Media Type', 415)); + $event->setResponse(new Response('Not Acceptable', 406)); } } elseif ($request->attributes->get('_legacy')) { diff --git a/core/lib/Drupal/Core/Routing/MimeTypeMatcher.php b/core/lib/Drupal/Core/Routing/MimeTypeMatcher.php index 031b2a2dae18e6fca01d7eafe484262f10377a73..f77e2541ad9ab20b303d3457e09a26bf2cbad895 100644 --- a/core/lib/Drupal/Core/Routing/MimeTypeMatcher.php +++ b/core/lib/Drupal/Core/Routing/MimeTypeMatcher.php @@ -8,7 +8,7 @@ namespace Drupal\Core\Routing; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException; +use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException; use Symfony\Component\Routing\RouteCollection; use Symfony\Cmf\Component\Routing\NestedMatcher\RouteFilterInterface; @@ -41,7 +41,7 @@ public function filter(RouteCollection $collection, Request $request) { } if (!count($filtered_collection)) { - throw new UnsupportedMediaTypeHttpException(); + throw new NotAcceptableHttpException(); } return $filtered_collection; diff --git a/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php b/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php index cb7fb6eec5af7f0e54f9c7142f37b9b9e650f8ad..96ec81076e5fd5839020ddaa28080cc3ed28a1fe 100644 --- a/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php @@ -60,7 +60,7 @@ public function testRead() { // Try to read the entity with an unsupported mime format. $response = $this->httpRequest('entity/' . $entity_type . '/' . $entity->id(), 'GET', NULL, 'application/wrongformat'); - $this->assertResponse(415); + $this->assertResponse(406); // Try to read an entity that does not exist. $response = $this->httpRequest('entity/' . $entity_type . '/9999', 'GET', NULL, $this->defaultMimeType); diff --git a/core/modules/system/lib/Drupal/system/Tests/Routing/MimeTypeMatcherTest.php b/core/modules/system/lib/Drupal/system/Tests/Routing/MimeTypeMatcherTest.php index 6061d5686a6e42adbbf68ddb8d89339da4e372e0..827c73386ecbb922d7dc9c5a606e6db93957688d 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Routing/MimeTypeMatcherTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Routing/MimeTypeMatcherTest.php @@ -11,7 +11,7 @@ use Drupal\simpletest\UnitTestBase; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException; +use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException; /** * Basic tests for the MimeTypeMatcher class. @@ -91,7 +91,7 @@ public function testNoRouteFound() { $routes = $matcher->filter($routes, $request); $this->fail(t('No exception was thrown.')); } - catch (UnsupportedMediaTypeHttpException $e) { + catch (NotAcceptableHttpException $e) { $this->pass('The correct exception was thrown.'); } }