summaryrefslogtreecommitdiff
path: root/src/Middleware
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-09-26 20:49:31 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-09-26 20:49:31 +0200
commitaa2124f655788dea3f15c3040f3201f2b64e14b0 (patch)
tree0419bd6c4fdf13104169a451eab37489833d1b71 /src/Middleware
parent66038eda14d5d4e624b6636a6156570e3e940e49 (diff)
RouteDispatcher: Allow installation into sub directory
Diffstat (limited to 'src/Middleware')
-rw-r--r--src/Middleware/RouteDispatcher.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Middleware/RouteDispatcher.php b/src/Middleware/RouteDispatcher.php
index f14faea8..24a7906d 100644
--- a/src/Middleware/RouteDispatcher.php
+++ b/src/Middleware/RouteDispatcher.php
@@ -2,6 +2,7 @@
namespace Engelsystem\Middleware;
+use Engelsystem\Http\Request;
use FastRoute\Dispatcher as FastRouteDispatcher;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
@@ -44,7 +45,12 @@ class RouteDispatcher implements MiddlewareInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
- $route = $this->dispatcher->dispatch($request->getMethod(), urldecode($request->getUri()->getPath()));
+ $path = $request->getUri()->getPath();
+ if ($request instanceof Request) {
+ $path = $request->getPathInfo();
+ }
+
+ $route = $this->dispatcher->dispatch($request->getMethod(), urldecode($path));
$status = $route[0];
if ($status == FastRouteDispatcher::NOT_FOUND) {