Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / lib / Drupal / Core / Routing / ContentTypeHeaderMatcher.php
index 13e18f35a9411b07eae2f792290d1d132cef9106..719eeb13289193e074af96bda92dbf2921a70692 100644 (file)
@@ -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')) {
+    // requests do not carry any content. Nothing to filter in this case. Same
+    // for all other safe methods.
+    if ($request->isMethodSafe(FALSE)) {
       return $collection;
     }
 
@@ -50,11 +50,4 @@ class ContentTypeHeaderMatcher implements RouteFilterInterface {
     }
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function applies(Route $route) {
-    return TRUE;
-  }
-
 }