Skip to content

Commit

Permalink
Tweak slash handing in router
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksleight committed Oct 1, 2015
1 parent 6fbdf31 commit dcce7ca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function route($name, $methods = null, $path = null, $params = null, \Clo
if (isset($this->_suffix)) {
$path = "{$path}/{$this->_suffix}";
}
$parts = explode('/', ltrim($path, '/'));
$parts = explode('/', trim($path, '/'));
$names = [];
$stack = [];
foreach ($parts as $i => $part) {
Expand Down Expand Up @@ -169,6 +169,7 @@ public function route($name, $methods = null, $path = null, $params = null, \Clo
public function match($method, $path)
{
$method = strtoupper($method);
$path = trim($path, '/');
foreach ($this->_routes as $name => $route) {
if (!in_array($method, $route['methods'])) {
continue;
Expand Down

0 comments on commit dcce7ca

Please sign in to comment.