From a73142eabbf1c85ca98ea1a0544f2f7cca151381 Mon Sep 17 00:00:00 2001 From: Valithor Obsidion Date: Wed, 5 Feb 2025 11:34:17 -0500 Subject: [PATCH] Update SegmentRouterTrait.php --- src/SegmentRouterTrait.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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' => []]; } /**