Update SegmentRouterTrait.php

This commit is contained in:
Valithor Obsidion 2025-02-05 11:34:17 -05:00
parent a395b7ae17
commit a73142eabb

View File

@ -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' => []];
}
/**