diff --git a/src/SegmentRouterTrait.php b/src/SegmentRouterTrait.php index a27490d..3b2518e 100644 --- a/src/SegmentRouterTrait.php +++ b/src/SegmentRouterTrait.php @@ -80,13 +80,12 @@ trait SegmentRouterTrait } } - // if the method doesn't exist, return 405 - if (! array_key_exists($method, $node)) { - return ['code' => 405, 'handler' => null, 'params' => []]; + // if we found a handler for the method, return it and any params. if not, return a 405 + if (array_key_exists($method, $node)) { + return ['code' => 200, 'handler' => $node[$method], 'params' => $params]; } - // if we found a handler for the method, return it and any params. if not, return a 405 - return ['code' => 200, 'handler' => $node[$method], 'params' => $params]; + return ['code' => 405, 'handler' => null, 'params' => []]; } /**