Skip to content

[2.x] fix(core): add missing method_not_allowed translation for error view#4418

Merged
imorland merged 1 commit into2.xfrom
im/method-not-allowed-translation-2x
Mar 8, 2026
Merged

[2.x] fix(core): add missing method_not_allowed translation for error view#4418
imorland merged 1 commit into2.xfrom
im/method-not-allowed-translation-2x

Conversation

@imorland
Copy link
Copy Markdown
Member

@imorland imorland commented Mar 8, 2026

Summary

Fixes #4238 (2.x counterpart to #4417)

When a MethodNotAllowedException is thrown, the HTTP 405 status code was correctly set, but the error page displayed the generic "An error occurred while trying to load this page." message instead of a specific one.

ViewFormatter::getMessage() looks up core.views.error.{type} — if the key doesn't exist, the translator returns the key itself, which is detected as a miss and falls through to the generic message. Adding the missing method_not_allowed translation key fixes this.

Test plan

  • Make a GET request to a POST-only route (e.g. /login)
  • Confirm the error page shows "This page does not support that request method." with a 405 status

🤖 Generated with Claude Code

Fixes #4238

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@imorland imorland requested a review from a team as a code owner March 8, 2026 10:18
@imorland imorland added this to the 2.0.0-beta.8 milestone Mar 8, 2026
@imorland imorland merged commit 3ef9b86 into 2.x Mar 8, 2026
27 checks passed
@imorland imorland deleted the im/method-not-allowed-translation-2x branch March 8, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text of MethodNotAllowedException is not properly rendered in the response body

1 participant