diff --git a/core/modules/hal/src/Tests/NormalizeTest.php b/core/modules/hal/src/Tests/NormalizeTest.php index 8f627c6..44d7f24 100644 --- a/core/modules/hal/src/Tests/NormalizeTest.php +++ b/core/modules/hal/src/Tests/NormalizeTest.php @@ -177,11 +177,6 @@ public function testNormalize() { * The entity URI. */ protected function getEntityUri(EntityInterface $entity) { - // Some entity types don't provide a canonical link template, at least call - // out to ->url(). - if (!$entity->hasLinkTemplate('canonical')) { - return $entity->url('canonical', []); - } $url = $entity->urlInfo('canonical', ['absolute' => TRUE]); return $url->setRouteParameter('_format', 'hal_json')->toString(); } diff --git a/core/modules/page_cache/src/Tests/PageCacheTest.php b/core/modules/page_cache/src/Tests/PageCacheTest.php index b466333..37fd06b 100644 --- a/core/modules/page_cache/src/Tests/PageCacheTest.php +++ b/core/modules/page_cache/src/Tests/PageCacheTest.php @@ -106,17 +106,17 @@ function testQueryParameterFormatRequests() { \Drupal::service('module_installer')->install(['node', 'rest', 'hal']); $this->drupalCreateContentType(['type' => 'article']); $node = $this->drupalCreateNode(['type' => 'article']); - $node_url = $node->urlInfo(); + $node_uri = $node->urlInfo(); $node_url_with_hal_json_format = $node->urlInfo('canonical')->setRouteParameter('_format', 'hal_json'); /** @var \Drupal\user\RoleInterface $role */ $role = Role::load('anonymous'); $role->grantPermission('restful get entity:node'); $role->save(); - $this->drupalGet($node_url); + $this->drupalGet($node_uri); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS'); $this->assertEqual($this->drupalGetHeader('Content-Type'), 'text/html; charset=UTF-8'); - $this->drupalGet($node_url); + $this->drupalGet($node_uri); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT'); $this->assertEqual($this->drupalGetHeader('Content-Type'), 'text/html; charset=UTF-8'); @@ -139,10 +139,10 @@ function testQueryParameterFormatRequests() { $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT'); $this->assertEqual($this->drupalGetHeader('Content-Type'), 'application/hal+json'); - $this->drupalGet($node_url); + $this->drupalGet($node_uri); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS'); $this->assertEqual($this->drupalGetHeader('Content-Type'), 'text/html; charset=UTF-8'); - $this->drupalGet($node_url); + $this->drupalGet($node_uri); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT'); $this->assertEqual($this->drupalGetHeader('Content-Type'), 'text/html; charset=UTF-8'); } diff --git a/core/modules/rest/src/Plugin/views/display/RestExport.php b/core/modules/rest/src/Plugin/views/display/RestExport.php index 4c25a76..2072605 100644 --- a/core/modules/rest/src/Plugin/views/display/RestExport.php +++ b/core/modules/rest/src/Plugin/views/display/RestExport.php @@ -267,8 +267,10 @@ public function collectRoutes(RouteCollection $collection) { // Format as a string using pipes as a delimiter. if ($formats = $style_plugin->getFormats()) { - // Always allow to at least access the page via HTML. This will return - // The first non HTML format which is configured/available. + // Allow a REST Export View to be returned with an HTML-only accept + // format. That allows browsers or other non-compliant systems to access + // the view, as it is unlikely to have a conflicting HTML representation + // anyway. $route->setRequirement('_format', implode('|', $formats + ['html'])); } } diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 6bfad12..25322ed 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -1419,7 +1419,7 @@ protected function drupalGetJSON($path, array $options = array(), array $headers * @return mixed * The result of the request. */ - protected function drupalGetWithFormat($path, $format, array $options = array(), array $headers = array()) { + protected function drupalGetWithFormat($path, $format, array $options = [], array $headers = []) { $options += ['query' => ['_format' => $format]]; return $this->drupalGet($path, $options, $headers); } @@ -1938,7 +1938,7 @@ protected function drupalPost($path, $accept, array $post, $options = array()) { * @see WebTestBase::getAjaxPageStatePostData() * @see WebTestBase::curlExec() */ - protected function drupalPostWithFormat($path, $format, array $post, $options = array()) { + protected function drupalPostWithFormat($path, $format, array $post, $options = []) { $options['query']['_format'] = $format; return $this->drupalPost($path, '', $post, $options); }