Skip to content

Repair Allow and OPTIONS semantics through route-level HTTP method - #160

Merged
alganet merged 1 commit into
Respect:masterfrom
alganet:options-method
Mar 17, 2026
Merged

alganet merged 1 commit into
Respect:masterfrom
alganet:options-method

Conversation

@alganet

@alganet alganet commented Mar 17, 2026

Copy link
Copy Markdown
Member

Make Allow generation and OPTIONS handling reflect effective HTTP semantics instead of raw declared route methods.

Changes:

  • add route-level method metadata APIs in AbstractRoute for effective method matching and allowed-method reporting
  • teach ControllerRoute to advertise and match only the HTTP methods its target can actually handle, including HEAD via GET fallback
  • centralize Router Allow computation from effective route methods and add implicit OPTIONS when a path is routable
  • keep explicit OPTIONS dispatch separate from transparent OPTIONS so custom handlers still run correctly
  • align 405, transparent OPTIONS, and OPTIONS * responses around the same Allow set
  • add regression coverage for HEAD in Allow, explicit OPTIONS Allow headers, global and transparent OPTIONS, and ANY controller routes rejecting unsupported methods

Verification:

  • composer qa

Make Allow generation and OPTIONS handling reflect effective HTTP semantics
instead of raw declared route methods.

Changes:
- add route-level method metadata APIs in AbstractRoute for effective method
  matching and allowed-method reporting
- teach ControllerRoute to advertise and match only the HTTP methods its
  target can actually handle, including HEAD via GET fallback
- centralize Router Allow computation from effective route methods and add
  implicit OPTIONS when a path is routable
- keep explicit OPTIONS dispatch separate from transparent OPTIONS so custom
  handlers still run correctly
- align 405, transparent OPTIONS, and OPTIONS * responses around the same
  Allow set
- add regression coverage for HEAD in Allow, explicit OPTIONS Allow headers,
  global and transparent OPTIONS, and ANY controller routes rejecting
  unsupported methods

Verification:
- composer qa
@alganet
alganet marked this pull request as ready for review March 17, 2026 21:22
@alganet
alganet merged commit ef30510 into Respect:master Mar 17, 2026
3 checks passed
@alganet
alganet deleted the options-method branch March 17, 2026 21:23
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.03922% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@4af5c01). Learn more about missing BASE report.
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/Routes/ControllerRoute.php 95.65% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master     #160   +/-   ##
=========================================
  Coverage          ?   95.85%           
  Complexity        ?      402           
=========================================
  Files             ?       27           
  Lines             ?      988           
  Branches          ?        0           
=========================================
  Hits              ?      947           
  Misses            ?       41           
  Partials          ?        0           

☔ 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.

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.

2 participants