Skip to content

Conversation

@olegbaturin
Copy link

Q A
Is bugfix?
New feature? ✔️
Breaks BC?
Fixed issues #249

prev #250

@samdark samdark requested a review from vjik August 31, 2025 17:43
@samdark
Copy link
Member

samdark commented Sep 4, 2025

As noted in #270 (comment), point 1 (default handler) is better to be done as in #270.

@codecov
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.69%. Comparing base (7b4d133) to head (6e3f263).
⚠️ Report is 17 commits behind head on master.

Additional details and impacted files
@@              Coverage Diff              @@
##             master     #266       +/-   ##
=============================================
- Coverage     97.40%   73.69%   -23.71%     
- Complexity      181      185        +4     
=============================================
  Files            16       18        +2     
  Lines           577      574        -3     
=============================================
- Hits            562      423      -139     
- Misses           15      151      +136     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@olegbaturin
Copy link
Author

Version with 'Handler' renamed to the 'Action'.

@olegbaturin
Copy link
Author

I'll update readme

@samdark samdark requested a review from Copilot September 29, 2025 22:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds configurable method failure handling to the Router middleware, allowing users to customize responses for HTTP method mismatches (405 errors) and OPTIONS requests. Previously, the Router middleware had hardcoded behavior for these scenarios.

  • Introduces MethodFailureHandlerInterface and MethodFailureHandler for customizable method failure responses
  • Modifies Router middleware to accept an optional method failure handler parameter
  • Updates configuration to provide default method failure handler via DI container

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/MethodFailureHandlerInterface.php Defines interface for handling method failure responses
src/MethodFailureHandler.php Default implementation that preserves existing 405/204 response behavior
src/Middleware/Router.php Updates constructor to accept optional method failure handler and removes hardcoded response logic
tests/Middleware/MethodFailureHandlerTest.php Test coverage for the default method failure handler
tests/Middleware/RouterTest.php Updates router tests to cover both with and without method failure handler scenarios
config/di-web.php New DI configuration file providing default method failure handler binding
README.md Documentation updates explaining the new method failure handling feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants