Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add options to control method failure handling in the Router middleware #250

Open
wants to merge 12 commits into
base: 3.x
Choose a base branch
from

Conversation

olegbaturin
Copy link

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

Copy link

codecov bot commented Oct 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (3.x@3728de1). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             3.x      #250   +/-   ##
=======================================
  Coverage       ?   100.00%           
  Complexity     ?       155           
=======================================
  Files          ?        11           
  Lines          ?       455           
  Branches       ?         0           
=======================================
  Hits           ?       455           
  Misses         ?         0           
  Partials       ?         0           

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

Copy link
Member

@samdark samdark left a comment

Choose a reason for hiding this comment

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

Overall 👍 Need some fixes.

CHANGELOG.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
### Automatic responses

`Yiisoft\Router\Middleware\Router` middleware responds automatically to:
- `OPTIONS` requests;
Copy link
Member

Choose a reason for hiding this comment

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

I think some examples or explanation are needed, since it is not clear how exactly it responds. It's documented below but I think it could be moved here somehow.

src/MethodsResponseFactoryInterface.php Outdated Show resolved Hide resolved
src/Middleware/Router.php Outdated Show resolved Hide resolved
src/Middleware/Router.php Outdated Show resolved Hide resolved
src/Middleware/Router.php Outdated Show resolved Hide resolved
tests/Middleware/RouterTest.php Outdated Show resolved Hide resolved
@samdark samdark requested a review from a team October 26, 2024 21:39
Comment on lines +90 to +92
: $this->responseFactory
->createResponse(Status::NO_CONTENT)
->withHeader(Header::ALLOW, implode(', ', $methods));
Copy link
Member

Choose a reason for hiding this comment

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

Extract it to new response factory class and use it by default for optionsResponseFactory.

Comment on lines +102 to +104
: $this->responseFactory
->createResponse(Status::METHOD_NOT_ALLOWED)
->withHeader(Header::ALLOW, implode(', ', $methods));
Copy link
Member

Choose a reason for hiding this comment

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

Extract it to new response factory class and use it by default for notAllowedResponseFactory.

@olegbaturin olegbaturin changed the title Add options to control method failure handling in the Router middleware [WIP] Add options to control method failure handling in the Router middleware Nov 8, 2024
@vjik vjik added the status:under development Someone is working on a pull request. label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:under development Someone is working on a pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants