Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
FIX: RequestHandler::__construct() should run after middlewares (fixes
  • Loading branch information
kinglozzer committed Mar 11, 2019
1 parent 19e5e91 commit ca781c6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Control/Director.php
Expand Up @@ -352,12 +352,11 @@ public function handleRequest(HTTPRequest $request)
break;
}

/** @var RequestHandler $controllerObj */
$controllerObj = Injector::inst()->create($arguments['Controller']);

// Handler for calling a controller
$handler = function (HTTPRequest $request) use ($controllerObj) {
// Handler for constructing and calling a controller
$handler = function (HTTPRequest $request) use ($arguments) {
try {
/** @var RequestHandler $controllerObj */
$controllerObj = Injector::inst()->create($arguments['Controller']);
return $controllerObj->handleRequest($request);
} catch (HTTPResponse_Exception $responseException) {
return $responseException->getResponse();
Expand Down

0 comments on commit ca781c6

Please sign in to comment.