summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2013-05-12 09:00:34 (GMT)
committerAlex Pott2013-05-12 09:00:34 (GMT)
commita858b3473cdedc8ef2d87f03812789ab09fd9f6a (patch)
tree4ac833672fc41a81a27409e2b3fe7494246869c5
parentf630b510aa5159d95f4e6263ebecfe503ac314d5 (diff)
Issue #1983710 by manarth: Fixed HTTP: Use 406 (Not acceptable) over 415 (Unsupported media type).
-rw-r--r--core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php2
-rw-r--r--core/lib/Drupal/Core/Routing/MimeTypeMatcher.php4
-rw-r--r--core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php2
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Routing/MimeTypeMatcherTest.php4
4 files changed, 6 insertions, 6 deletions
diff --git a/core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php
index ac48bc8..fa4be98 100644
--- a/core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php
@@ -59,7 +59,7 @@ class ViewSubscriber implements EventSubscriberInterface {
$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 031b2a2..f77e254 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 @@ class MimeTypeMatcher implements RouteFilterInterface {
}
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 cb7fb6e..96ec810 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 @@ class ReadTest extends RESTTestBase {
// 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 6061d56..827c733 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\Core\Routing\MimeTypeMatcher;
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 @@ class MimeTypeMatcherTest extends UnitTestBase {
$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.');
}
}