summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-02-09 12:11:00 (GMT)
committerNathaniel Catchpole2016-02-09 12:11:00 (GMT)
commit61375924d4981265a10c3adf4e10e8b9d174a42b (patch)
tree53b3bbb8f86c39ba0c1fd507f5517694288ac049
parent805a22e9c342b3a4b3f383efbe9f1b78b8826bec (diff)
Issue #2417917 by clemens.tolboom, sudhanshug, Wim Leers, joelpittet: Include content type format name in error response
-rw-r--r--core/lib/Drupal/Core/Routing/ContentTypeHeaderMatcher.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php2
2 files changed, 2 insertions, 2 deletions
diff --git a/core/lib/Drupal/Core/Routing/ContentTypeHeaderMatcher.php b/core/lib/Drupal/Core/Routing/ContentTypeHeaderMatcher.php
index 0bfb699..103e25b 100644
--- a/core/lib/Drupal/Core/Routing/ContentTypeHeaderMatcher.php
+++ b/core/lib/Drupal/Core/Routing/ContentTypeHeaderMatcher.php
@@ -47,7 +47,7 @@ class ContentTypeHeaderMatcher implements RouteFilterInterface {
// We do not throw a
// \Symfony\Component\Routing\Exception\ResourceNotFoundException here
// because we don't want to return a 404 status code, but rather a 415.
- throw new UnsupportedMediaTypeHttpException('No route found that matches the Content-Type header.');
+ throw new UnsupportedMediaTypeHttpException('No route found that matches "Content-Type: ' . $request->headers->get('Content-Type') . '"');
}
/**
diff --git a/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php b/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php
index 1f734e7..adaa993 100644
--- a/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php
@@ -94,7 +94,7 @@ class ContentTypeHeaderMatcherTest extends UnitTestCase {
* Confirms that the matcher throws an exception for no-route.
*
* @expectedException \Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException
- * @expectedExceptionMessage No route found that matches the Content-Type header.
+ * @expectedExceptionMessage No route found that matches "Content-Type: application/hal+json"
*/
public function testNoRouteFound() {
$matcher = new ContentTypeHeaderMatcher();