Skip to content

Commit e677fd1

Browse files
committed
Call onBeforeExecute middleware first
This will: - Fix an issue where `RouteMap` instances are executed without request middlewares. - Allow the user to change the resolved action by hacking the request URI from the middleware
1 parent 1d97351 commit e677fd1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/WaterPipe/WaterPipe.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,9 @@ private function _findRouteMap()
495495
private function _executeRequest()
496496
{
497497
try {
498+
// Execute middleware
499+
self::triggerBeforeExecuteEvent(Request::capture());
500+
498501
$map = $this->_findRouteMap();
499502

500503
if ($map !== null) {
@@ -558,9 +561,6 @@ private function _executeRequest()
558561
throw new \Exception("Malformed route action");
559562
}
560563

561-
// Execute middleware
562-
self::triggerBeforeExecuteEvent(Request::capture());
563-
564564
// NOTE: No code will be executed after this call...
565565
$this->_executeAction($runner);
566566
} catch (\Exception $e) {

0 commit comments

Comments
 (0)