X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FRouting%2FContentTypeHeaderMatcher.php;h=7d66b50ecefd80ce5b5584fc07217030d85e54b8;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=13e18f35a9411b07eae2f792290d1d132cef9106;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/Routing/ContentTypeHeaderMatcher.php b/web/core/lib/Drupal/Core/Routing/ContentTypeHeaderMatcher.php index 13e18f35a..7d66b50ec 100644 --- a/web/core/lib/Drupal/Core/Routing/ContentTypeHeaderMatcher.php +++ b/web/core/lib/Drupal/Core/Routing/ContentTypeHeaderMatcher.php @@ -4,21 +4,21 @@ namespace Drupal\Core\Routing; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException; -use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; /** * Filters routes based on the HTTP Content-type header. */ -class ContentTypeHeaderMatcher implements RouteFilterInterface { +class ContentTypeHeaderMatcher implements FilterInterface { /** * {@inheritdoc} */ public function filter(RouteCollection $collection, Request $request) { - // The Content-type header does not make sense on GET requests, because GET - // requests do not carry any content. Nothing to filter in this case. - if ($request->isMethod('GET')) { + // The Content-type header does not make sense on GET or DELETE requests, + // because they do not carry any content. Nothing to filter in this case. + // Same for all other safe methods. + if ($request->isMethodSafe(FALSE) || $request->isMethod('DELETE')) { return $collection; } @@ -50,11 +50,4 @@ class ContentTypeHeaderMatcher implements RouteFilterInterface { } } - /** - * {@inheritdoc} - */ - public function applies(Route $route) { - return TRUE; - } - }