Problem/Motivation

Quoting @dawehner from #2813755-13: JSON responses encoded inconsistently: make them all RFC4627-compliant:

One question though I'd ask in general, shouldn't we strip of HTML out of those errors messages? For me those don't make sense, beside making it harder to read.

\Drupal\Component\Render\PlainTextOutput::renderFromHtml or a potential different implementation, could be used here.

Proposed resolution

Update \Drupal\rest\Plugin\rest\resource\EntityResource::validate().

Remaining tasks

TBD

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers created an issue. See original summary.

dawehner’s picture

Status: Active » Needs review
FileSize
5.47 KB

Here is a patch for this.

Status: Needs review » Needs work

The last submitted patch, 2: 2835683-2.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
6.26 KB
1.16 KB

I hope I caught all of them.

Wim Leers’s picture

Status: Needs review » Needs work

This looks great, just one nit :) Once that's done, this is RTBC. Thanks!

+++ b/core/modules/rest/src/Plugin/rest/resource/EntityResourceValidationTrait.php
@@ -35,7 +36,9 @@ protected function validate(EntityInterface $entity) {
+        // message on REST requests.

s/on REST requests/in REST responses/

dawehner’s picture

Status: Needs work » Needs review
FileSize
905 bytes
6.28 KB

He, I think Drupal got adult: It no longer mixes up requests and responses, URLs and links etc. :) Good catch.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed fb33894 and pushed to 8.3.x. Thanks!

  • alexpott committed fb33894 on 8.3.x
    Issue #2835683 by dawehner, Wim Leers: Remove HTML from EntityResource...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Wim Leers’s picture