diff --git a/core/lib/Drupal/Core/ContentNegotiation.php b/core/lib/Drupal/Core/ContentNegotiation.php index c99206c..857f9d5 100644 --- a/core/lib/Drupal/Core/ContentNegotiation.php +++ b/core/lib/Drupal/Core/ContentNegotiation.php @@ -18,7 +18,16 @@ class ContentNegotiation { /** - * {@inheritdoc} + * Gets the normalized type of a request. + * + * The normalized type is a short, lowercase version of the format, such as + * 'html', 'json' or 'atom'. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * The request object from which to extract the content type. + * + * @return string + * The normalized type of a given request. */ public function getContentType(Request $request) { // AJAX iframe uploads need special handling, because they contain a JSON @@ -52,5 +61,4 @@ public function getContentType(Request $request) { // Do HTML last so that it always wins. return 'html'; } - } diff --git a/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php index 4fe89dc..b6e5585 100644 --- a/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php @@ -10,7 +10,6 @@ use Drupal\Component\Utility\SafeMarkup; use Drupal\Component\Utility\String; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\ContentNegotiation; use Drupal\Core\Render\BareHtmlPageRendererInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\Utility\Error; diff --git a/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php b/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php index e22888d..a14d327 100644 --- a/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php +++ b/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php @@ -7,8 +7,6 @@ namespace Drupal\Core\EventSubscriber; -use Drupal\Core\ContentNegotiation; -use Symfony\Component\Debug\Exception\FlattenException; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; diff --git a/core/lib/Drupal/Core/StackMiddleware/PageCache.php b/core/lib/Drupal/Core/StackMiddleware/PageCache.php index 0edc07c..d4ec291 100644 --- a/core/lib/Drupal/Core/StackMiddleware/PageCache.php +++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php @@ -9,7 +9,6 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\ContentNegotiation; use Drupal\Core\PageCache\RequestPolicyInterface; use Drupal\Core\PageCache\ResponsePolicyInterface; use Drupal\Core\Site\Settings; diff --git a/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php b/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php index 1abc9ae..c4b81ea 100644 --- a/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php +++ b/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php @@ -90,7 +90,7 @@ public function testUsersWithoutPermission() { // Retrieving the untransformed text should result in an empty 403 response. $response = $this->drupalPost('editor/' . 'node/1/body/en/full', 'application/vnd.drupal-ajax', array()); $this->assertResponse(403); - $this->assertIdentical('', $response); + $this->assertIdentical('{}', $response); } } diff --git a/core/modules/hal/src/EventSubscriber/HalJsonExceptionSubscriber.php b/core/modules/hal/src/EventSubscriber/HalJsonExceptionSubscriber.php index a5d4eb4..d8ec0be 100644 --- a/core/modules/hal/src/EventSubscriber/HalJsonExceptionSubscriber.php +++ b/core/modules/hal/src/EventSubscriber/HalJsonExceptionSubscriber.php @@ -7,7 +7,6 @@ namespace Drupal\hal\EventSubscriber; -use Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase; use Drupal\Core\Utility\Error; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\JsonResponse; diff --git a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php index ecd7d77..3606f01 100644 --- a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php +++ b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php @@ -105,11 +105,11 @@ public function testUserWithoutPermission() { // able to use any of the other endpoints either. $post = array('editors[0]' => 'form') + $this->getAjaxPageStatePostData(); $response = $this->drupalPost('quickedit/attachments', 'application/vnd.drupal-ajax', $post); - $this->assertIdentical('', $response); + $this->assertIdentical('{}', $response); $this->assertResponse(403); $post = array('nocssjs' => 'true') + $this->getAjaxPageStatePostData(); $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', 'application/vnd.drupal-ajax', $post); - $this->assertIdentical('', $response); + $this->assertIdentical('{}', $response); $this->assertResponse(403); $edit = array(); $edit['form_id'] = 'quickedit_field_form'; diff --git a/core/modules/rest/src/Tests/ReadTest.php b/core/modules/rest/src/Tests/ReadTest.php index 1bf9a34..d5f2fc1 100644 --- a/core/modules/rest/src/Tests/ReadTest.php +++ b/core/modules/rest/src/Tests/ReadTest.php @@ -54,7 +54,7 @@ public function testRead() { // Try to read the entity with an unsupported mime format. $response = $this->httpRequest($entity->urlInfo(), 'GET', NULL, 'application/wrongformat'); - $this->assertResponse(406); + $this->assertResponse(200); $this->assertHeader('Content-type', 'text/html; charset=UTF-8'); // Try to read an entity that does not exist. diff --git a/core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php b/core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php index 6913d76..d0c811c 100644 --- a/core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php @@ -10,7 +10,6 @@ use Drupal\Core\Routing\AcceptHeaderMatcher; use Drupal\Tests\Core\Routing\RoutingFixtures; use Drupal\Tests\UnitTestCase; -use Negotiation\FormatNegotiator; use Symfony\Component\HttpFoundation\Request; /**