Skip to content

Fix route resolution for PSR requests - #7

Merged
gabrielsolomon merged 3 commits into
masterfrom
fix/psr-request-routing
Nov 24, 2026
Merged

gabrielsolomon merged 3 commits into
masterfrom
fix/psr-request-routing

Conversation

@gabrielsolomon

Copy link
Copy Markdown
Contributor

Summary

  • Adapt incoming PSR server requests to Symfony requests for route context and matching.
  • Forward matched route values as PSR request attributes while preserving Symfony request attributes.
  • Avoid reading/consuming the PSR request body during route resolution.
  • Add regression coverage for wrapped and generic PSR requests.

Validation

  • PHP syntax checks and git diff --check pass.
  • PHPUnit could not be run because dependencies are not installed in this checkout.

Adapt PSR server requests for Symfony route matching and preserve matched route attributes on the forwarded request. Add regression coverage for wrapped and generic PSR requests.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 07:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The request adapter discards PSR-7 query parameters that differ from the URI, causing Symfony route conditions to see stale or missing values and potentially select the wrong route.

1 open issue
What changed in this PR

This PR bridges PSR server requests to the router’s Symfony-based matching API while forwarding matched route values to downstream handlers.

Changes:

  • Adapts PSR requests for routing context and matching without reading the body.
  • Forwards route values as PSR attributes while retaining Symfony attributes and framework setters.
  • Adds regression tests for wrapped and generic PSR requests.
File Description
tests/​src/​Middleware/​RouteResolverMiddlewareTest.php Adds coverage for PSR matching, route attributes, routing context, and avoiding body access.
src/​Middleware/​RouteResolverMiddleware.php Adds request adaptation and forwards requests containing matched route attributes.

Review effort: Balanced

[],
$request->getServerParams()
);
$symfonyRequest->headers->replace($request->getHeaders());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Synced Symfony’s query bag from getQueryParams() for both adapted and reused requests, with regression coverage. Commit: cf794c4.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@gabrielsolomon
gabrielsolomon merged commit ab02ef5 into master Nov 24, 2026
8 of 11 checks passed
@gabrielsolomon
gabrielsolomon deleted the fix/psr-request-routing branch November 24, 2026 21:07
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