- Issue created by @rares badita
- π³πΏNew Zealand quietone
@Rares Badita, thanks for the issue.
Issues are solve on the main development branch first, 11.x. Also restoring the template so we can keep track of any work done here.
- π·π΄Romania rares badita Bucharest
I've tinkered a bit with the issue, and I think the behaviour used for processing the form when contextual filter are present should be also used when there are no contextual filters.
- π¬π§United Kingdom catch
Given this is a user-facing PHP error (and the preview just doesn't work in this case), bumping to major.
- π·π΄Romania rares badita Bucharest
The issue arises when creating a URL from a request using the
Url::createFromRequest($request)
method.
When the Router class tries to match the url of the $request parameter to a route, we reach this code:// Check HTTP method requirement. if ($requiredMethods = $route->getMethods()) { // HEAD and GET are equivalent as per RFC. if ('HEAD' === $method = $this->context->getMethod()) { $method = 'GET'; } if (!in_array($method, $requiredMethods)) { $this->allow = array_merge($this->allow, $requiredMethods); $routes->remove($name); continue; } }
The problem is that the $method used to check against $requiredMethods is not obtained from the current $request, but from $context, which is the original request from the request stack.
This leads to an issue with REST exports that use the Facets serializer view style. When building the facets results,
FacetsUrlGenerator::getUrlForRequest()
wants to create a URL from a request to the actual view display(made with GET), not to the preview form(made with POST), thus resulting in a method mismatch and an exception being thrown.I've added a patch for the Facets module to catch this exception.
I've also changed the issue project from views-ui to facets.
- First commit to issue fork.
- Merge request !228Issue #3459885: The view preview section sends a POST request, but REST exports routes only accept GET requests β (Open) created by codebymikey