Skip to content
Next
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
291
Merge Requests
38
CI / CD
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
13c0d96f
Commit
13c0d96f
authored
36 minutes ago
by
Emiliano Balbuena
Browse files
Options
Download
(chore): Short-circuit pre-PSR7 router
parent
2d8854b8
epic/modern-router
1 merge request
!342
WIP: (feat): Modernize Router (&75)
Pipeline
#93894016
failed with stages
in 4 minutes and 33 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
12 deletions
+6
-12
Core/Router.php
View file @
13c0d96f
...
...
@@ -39,13 +39,13 @@ class Router
);
// TODO: Ensure it works with reverse proxy
$response
=
$dispatcher
->
pipe
(
new
Kernel\CorsMiddleware
())
->
pipe
(
new
Kernel\ContentNegotiationMiddleware
())
->
pipe
(
new
Kernel\ErrorHandlerMiddleware
())
->
pipe
(
(
new
Kernel\RouteResolverMiddleware
())
->
setAttributeName
(
'_request-handler'
)
)
)
// Note: Pre-PSR7 routes will not advance further than this
->
pipe
(
new
Kernel\CorsMiddleware
())
->
pipe
(
new
Kernel\JsonPayloadMiddleware
())
->
pipe
(
new
Kernel\FrameSecurityMiddleware
())
->
pipe
(
...
...
This diff is collapsed.
Core/Router/Middleware/Kernel/RouteResolverMiddleware.php
View file @
13c0d96f
...
...
@@ -77,22 +77,16 @@ class RouteResolverMiddleware implements MiddlewareInterface
// Pre PSR-7 Controllers
if
(
$prePsr7Fallback
->
shouldRoute
(
$request
->
getUri
()
->
getPath
()))
{
return
$handler
->
handle
(
$request
->
withAttribute
(
$this
->
attributeName
,
[
$prePsr7Fallback
,
'handle'
])
)
return
$prePsr7Fallback
->
handle
(
$request
)
->
withHeader
(
'X-Route-Resolver'
,
'pre-psr7'
);
}
// Static HTML
if
(
$request
->
getAttribute
(
'accept'
)
===
'html'
)
{
return
$handler
->
handle
(
$request
->
withAttribute
(
$this
->
attributeName
,
[
$prePsr7Fallback
,
'handleStatic'
])
)
return
$prePsr7Fallback
->
handleStatic
(
$request
)
->
withHeader
(
'X-Route-Resolver'
,
'pre-psr7-static'
);
}
...
...
This diff is collapsed.
Please
register
or
sign in
to comment