Problem/Motivation
See #2293697-174: EntityResource POST routes all use the confusing default: use entity types' https://www.drupal.org/link-relations/create link template if available. Blocked on #2822190: PathValidator validates based on a RequestContext leaked from the current request, resulting in false negatives during CLI requests and POST submissions.
As of #2293697: EntityResource POST routes all use the confusing default: use entity types' https://www.drupal.org/link-relations/create link template if available, it's possible to POST to /node instead of /entity/node, to /taxonomy/term instead of /entity/taxonomy_term, and so on.
A notable exception: for creating User entities, you still have to POST to /entity/user, not /user.
The tricky thing is that /user is also a non-REST route: user.page, which accepts POST requests in any format, and therefore interferes with the REST route that's also registered at /user. We cannot make the non-REST route GET-only, because there might be forms there, e.g. in blocks (see @dawehner in #13).
Proposed resolution
Enable POSTing to /user by:
- adding a
createlink relation type toUser's annotation - figuring out a feasible fix/solution/work-around to actually make this work as expected
Remaining tasks
TBD
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 2851984-8.patch | 2.93 KB | wim leers |
Comments
Comment #2
wim leersHere's the interdiff from #2293697-177: EntityResource POST routes all use the confusing default: use entity types' https://www.drupal.org/link-relations/create link template if available, but reversed. That should provide a great starting point for this patch.
Comment #3
wim leers#2293697: EntityResource POST routes all use the confusing default: use entity types' https://www.drupal.org/link-relations/create link template if available is in! This is now unblocked :)
Comment #5
wim leers#2 didn't apply anymore; rebased.
Comment #6
wim leersFrom #2293697-168: EntityResource POST routes all use the confusing default: use entity types' https://www.drupal.org/link-relations/create link template if available:
Since #2822190: PathValidator validates based on a RequestContext leaked from the current request, resulting in false negatives during CLI requests and POST submissions has landed (but gained a follow-up: #2852107: PathValidator::getUrlIfValid() does not support non-HTML/non-GET routes), we should be able to remove the changes to
ContactSitewideTest.Comment #8
wim leersTurns out that Symfony has deprecated setting
You actually need to do this now:
Fixing that makes tests pass :)
Comment #9
wim leersPer #8, closed #2852107: #2852107-4: PathValidator::getUrlIfValid() does not support non-HTML/non-GET routes.
Comment #11
dawehnerAs said on IRC, we are fucked, given that any forms can appear on those routes, so they need to support POST.
Comment #12
wim leersYes, so:
this is unacceptable, because there may be a
method="post"form on this page, which then won't work due to this change.This is because our rendering + routing system are intertangled.
Comment #13
dawehnerLater on we could then have form specific routes for a more optimized POST processing.
Comment #14
wim leersYep. We've been needing that for years.
Comment #15
wim leersThis is the issue for that.
Comment #16
berdirHm. What exactly is special about /user?
/node also exists in the form of the default frontpage view that uses that path. So if you create the same contact form and configure it to point to /node, then you get the same probem? Or any other path?
I suspect the only difference is that only /user happens to have test coverage in HEAD, but it could affect other routes as well on sites?
Comment #18
wim leersUpdated IS title + summary.
Comment #19
wim leers#16 is asking great questions.
It exists always and accepts
POSTrequests. Then when you make aPOSTrequest when you're not logged in, it redirects to somewhere else, which causes the HTTP client to repeat itsPOSTrequest, at which point multiple routes match, some match is selected, and you get a very unexpected and quite illogical 200 response.See the details at #2293697-150: EntityResource POST routes all use the confusing default: use entity types' https://www.drupal.org/link-relations/create link template if available + #2293697-157: EntityResource POST routes all use the confusing default: use entity types' https://www.drupal.org/link-relations/create link template if available + later.
No, see above.
Comment #20
wim leersI think a key question here is
In other words: how important is it that we make this work in the nice way? So then the question becomes: is it common to create
Userentities?To which I think the answer is: . So let's "won't fix" this.