diff --git a/core/core.api.php b/core/core.api.php index d8d42a55354..12735b89ea2 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -128,7 +128,7 @@ * - The request method must be set to the REST method you are using (POST, * GET, PATCH, etc.). * - The content type for the data you send, or the accept type for the - * data you are receiving, must be set to 'application/hal+json'. + * data you are receiving, must be set to 'application/json'. * - If you are sending data, it must be JSON-encoded. * - You'll also need to make sure the authentication information is sent * with the request, unless you have allowed access to anonymous users. diff --git a/core/modules/rest/rest.module b/core/modules/rest/rest.module index ae40970698e..bf44da34875 100644 --- a/core/modules/rest/rest.module +++ b/core/modules/rest/rest.module @@ -20,7 +20,7 @@ function rest_help($route_name, RouteMatchInterface $route_match) { $output .= '

' . t('Uses') . '

'; $output .= '
'; $output .= '
' . t('Installing supporting modules') . '
'; - $output .= '
' . t('In order to use REST on a website, you need to install modules that provide serialization and authentication services. You can use the Core module HAL for serialization and HTTP Basic Authentication for authentication, or install a contributed or custom module.', [':hal' => (\Drupal::moduleHandler()->moduleExists('hal')) ? Url::fromRoute('help.page', ['name' => 'hal'])->toString() : 'https://www.drupal.org/docs/8/core/modules/hal/overview', ':basic_auth' => (\Drupal::moduleHandler()->moduleExists('basic_auth')) ? Url::fromRoute('help.page', ['name' => 'basic_auth'])->toString() : 'https://www.drupal.org/docs/8/core/modules/basic_auth/overview']) . '
'; + $output .= '
' . t('In order to use REST on a website, you need to install modules that provide serialization and authentication services. You can use the Core module serialization for serialization and HTTP Basic Authentication for authentication, or install a contributed or custom module.', [':serialization' => (\Drupal::moduleHandler()->moduleExists('serialization')) ? Url::fromRoute('help.page', ['name' => 'serialization'])->toString() : 'https://www.drupal.org/docs/8/core/modules/serialization/overview', ':basic_auth' => (\Drupal::moduleHandler()->moduleExists('basic_auth')) ? Url::fromRoute('help.page', ['name' => 'basic_auth'])->toString() : 'https://www.drupal.org/docs/8/core/modules/basic_auth/overview']) . '
'; $output .= '
' . t('Enabling REST support for an entity type') . '
'; $output .= '
' . t('REST support for content types (provided by the Node module) is enabled by default. To enable support for other content entity types, you can use a process based on configuration editing or the contributed REST UI module.', [':node' => (\Drupal::moduleHandler()->moduleExists('node')) ? Url::fromRoute('help.page', ['name' => 'node'])->toString() : '#', ':config' => 'https://www.drupal.org/documentation/modules/rest', ':restui' => 'https://www.drupal.org/project/restui']) . '
'; $output .= '
' . t('You will also need to grant anonymous users permission to perform each of the REST operations you want to be available, and set up authentication properly to authorize web requests.') . '
'; diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index d87c4b39e7d..49db1df5de8 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -64,7 +64,7 @@ use Psr\Http\Message\ResponseInterface; * * If there is an entity type-specific format-specific edge case to test, then * add that to a concrete subclass. Example: - * \Drupal\Tests\hal\Functional\EntityResource\Comment\CommentHalJsonTestBase::$patchProtectedFieldNames + * \Drupal\Tests\comment\Functional\Rest\CommentJsonAnonTest::$patchProtectedFieldNames */ abstract class EntityResourceTestBase extends ResourceTestBase { @@ -1386,7 +1386,7 @@ abstract class EntityResourceTestBase extends ResourceTestBase { protected function assertStoredEntityMatchesSentNormalization(array $sent_normalization, FieldableEntityInterface $modified_entity) { foreach ($sent_normalization as $field_name => $field_normalization) { // Some top-level keys in the normalization may not be fields on the - // entity (for example '_links' and '_embedded' in the HAL normalization). + // entity. if ($modified_entity->hasField($field_name)) { $field_definition = $modified_entity->get($field_name)->getFieldDefinition(); $property_definitions = $field_definition->getItemDefinition()->getPropertyDefinitions(); diff --git a/core/modules/rest/tests/src/Functional/ResourceTest.php b/core/modules/rest/tests/src/Functional/ResourceTest.php index 1ebe619d4d7..23e7fa5fb1a 100644 --- a/core/modules/rest/tests/src/Functional/ResourceTest.php +++ b/core/modules/rest/tests/src/Functional/ResourceTest.php @@ -82,7 +82,7 @@ class ResourceTest extends BrowserTestBase { // non-REST route a match, but a lower quality one: no format restrictions // means there's always a match and hence when there is no matching REST // route, the non-REST route is used, but can't render into - // application/hal+json, so it returns a 406. + // application/json, so it returns a 406. $this->assertSession()->statusCodeEquals(406); } @@ -108,7 +108,7 @@ class ResourceTest extends BrowserTestBase { // non-REST route a match, but a lower quality one: no format restrictions // means there's always a match and hence when there is no matching REST // route, the non-REST route is used, but can't render into - // application/hal+json, so it returns a 406. + // application/json, so it returns a 406. $this->assertSession()->statusCodeEquals(406); } diff --git a/core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizer.php b/core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizer.php index 433cd5c421c..f9acaa8bdb6 100644 --- a/core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizer.php +++ b/core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizer.php @@ -59,7 +59,6 @@ class EntityReferenceFieldItemNormalizer extends FieldItemNormalizer { $values['url'] = $url->getGeneratedUrl(); } // @todo Remove in https://www.drupal.org/project/drupal/issues/2925520 - // @see \Drupal\hal\Normalizer\FileEntityNormalizer elseif ($entity instanceof FileInterface) { $values['url'] = $entity->createFileUrl(FALSE); } diff --git a/core/modules/system/tests/src/Functional/Render/RenderArrayNonHtmlSubscriberTest.php b/core/modules/system/tests/src/Functional/Render/RenderArrayNonHtmlSubscriberTest.php index 6bdc5a2b78b..997d7838ea6 100644 --- a/core/modules/system/tests/src/Functional/Render/RenderArrayNonHtmlSubscriberTest.php +++ b/core/modules/system/tests/src/Functional/Render/RenderArrayNonHtmlSubscriberTest.php @@ -36,7 +36,7 @@ class RenderArrayNonHtmlSubscriberTest extends BrowserTestBase { $this->assertSession()->pageTextContains("Controller response successfully rendered."); // Test that correct response code is returned for any non-HTML format. - foreach (['json', 'hal+json', 'xml', 'foo'] as $format) { + foreach (['json', 'xml', 'foo'] as $format) { $url = Url::fromRoute('render_array_non_html_subscriber_test.render_array', [ '_format' => $format, ]);