diff --git a/core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderRoutingTestServiceProvider.php b/core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderRoutingTestServiceProvider.php index 98e30e9..e1cab64 100644 --- a/core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderRoutingTestServiceProvider.php +++ b/core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderRoutingTestServiceProvider.php @@ -21,6 +21,8 @@ class AcceptHeaderRoutingTestServiceProvider implements ServiceModifierInterface public function alter(ContainerBuilder $container) { // Remove the basic content negotation middleware and replace it with a // basic header based one. - $container->register('http_negotiation.format_negotiator', 'Drupal\accept_header_routing_test\CustomContentNegotiation'); + $container->register('http_middleware.negotiation', 'Drupal\accept_header_routing_test\AcceptHeaderMiddleware') + ->addTag('http_middleware', ['priority' => 400]); } + } diff --git a/core/modules/system/tests/modules/accept_header_routing_test/src/CustomContentNegotiation.php b/core/modules/system/tests/modules/accept_header_routing_test/src/CustomContentNegotiation.php deleted file mode 100644 index ac72052..0000000 --- a/core/modules/system/tests/modules/accept_header_routing_test/src/CustomContentNegotiation.php +++ /dev/null @@ -1,55 +0,0 @@ -. - if ($request->get('ajax_iframe_upload', FALSE)) { - return 'iframeupload'; - } - - if ($request->query->has('_format')) { - return $request->query->get('_format'); - } - - // Create accept header map. - $type_map = [ - 'application/json' => 'json', - 'application/hal+json' => 'hal_json', - 'application/xml' => 'xml', - 'text/html' => 'html', - ]; - - // Get the first accept header. - $accept = explode(',', $request->headers->get('Accept')); - - // Check to see if the accept header is in out list. - if (isset($type_map[$accept[0]])) { - return $type_map[$accept[0]]; - } - - if ($request->isXmlHttpRequest()) { - return 'ajax'; - } - - // Do HTML last so that it always wins. - return 'html'; - } -}