Open
Description
Summary
The validation based on the new (2.3.0+) HTTP method marker interfaces (HttpGetActionInterface, HttpPostActionInterface, ...) throw an exception that is turned into a 404 response by the front controller:
throw new InvalidRequestException(
new NotFoundException(new Phrase('Page not found.'))
);
A proper response status code would be 405 Method Not Allowed
.
Steps to reproduce
- Make a GET request to an action with
HttpPostActionInterface
- Watch the status code received.
Expected Result
- 404 Not Found.
Actual Result
- 405 Method Not Allowed.
Proposed solution
- Use a different "replace result" than
NotFoundException
that at least returns an error page with the correct status code. Minimum solution: send correct status code - Do not mis-use exceptions as results at all Architectural improvement: do not mix unrelated types
- Add more marker interfaces to determine the type of result, i.e.
JsonActionInterface
,HtmlActionInterface
, ... and return a different body depending on those Ideal solution: enable handling of 405 errors in different context
Metadata
Metadata
Assignees
Labels
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Failed. Automatic verification of issue format is failedGate 4. Acknowledged. Issue is added to backlog and ready for developmentMay be fixed according to the position in the backlog.The issue has been reproduced on latest 2.3 releaseAffects non-critical data or functionality and does not force users to employ a workaround.