Add opt-in 405 Method Not Allowed responses by EduardoAC · Pull Request #191 · pillarjs/router
Navigation Menu
{{ message }}
- Notifications You must be signed in to change notification settings
- Fork 120
Comments
Open
EduardoAC wants to merge 1 commit intopillarjs:masterfrom
Open
Add opt-in 405 Method Not Allowed responses#191
EduardoAC wants to merge 1 commit intopillarjs:masterfrom
Add opt-in 405 Method Not Allowed responses#191
EduardoAC wants to merge 1 commit intopillarjs:masterfrom
Conversation
Copy link
EduardoAC
commented
Feb 21, 2026
EduardoAC
commented
Summary
- Adds an opt-in
methodNotAllowedRouter option to return405 Method Not Allowedwhen a route path matches but the HTTP method is unsupported. - Sets an
Allowheader based on matched route methods (includesHEADwhenGETis supported via existing helpers). - Default behaviour remains unchanged (still falls through to 404 without the option).
Why
Addresses expressjs/express#2414 by providing a per-router configurable 405 response without breaking existing applications.
Tests
npx mocha --reporter spec --check-leaks test/
Collect Allow header from matched routes when enabled
EduardoAC
mentioned this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment