-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
base: 3.x
Are you sure you want to change the base?
Conversation
olegbaturin
commented
Oct 25, 2024
Q | A |
---|---|
Is bugfix? | ❌ |
New feature? | ✔️ |
Breaks BC? | ❌ |
Fixed issues | #249 |
add factories for the method failure responses
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
There was a problem hiding this 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.
### Automatic responses | ||
|
||
`Yiisoft\Router\Middleware\Router` middleware responds automatically to: | ||
- `OPTIONS` requests; |
There was a problem hiding this comment.
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.
: $this->responseFactory | ||
->createResponse(Status::NO_CONTENT) | ||
->withHeader(Header::ALLOW, implode(', ', $methods)); |
There was a problem hiding this comment.
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
.
: $this->responseFactory | ||
->createResponse(Status::METHOD_NOT_ALLOWED) | ||
->withHeader(Header::ALLOW, implode(', ', $methods)); |
There was a problem hiding this comment.
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
.