Skip to content

Commit

Permalink
fix: cannot setting params. Sometimes 'notFound' would be considered …
Browse files Browse the repository at this point in the history
…'notAllowed'
  • Loading branch information
inhere committed May 2, 2018
1 parent 56e3cea commit 1aef8f2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Router/HandlerMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ protected function prepareForMap(string $route, $handler, array $opts): array
protected function collectParamRoute(string $route, array $methods, array $conf)
{
$conf['original'] = $route;
$params = $this->getAvailableParams($opts['params'] ?? []);
$params = $this->getAvailableParams($conf['option']['params'] ?? []);
list($first, $conf) = $this->parseParamRoute($route, $params, $conf);

// route string have regular
Expand Down Expand Up @@ -366,7 +366,10 @@ protected function findInRegularRoutes(array $routesData, string $path, string $
}
}

return [self::NOT_FOUND, \explode(',', \trim($allowedMethods, ','))];
return [
self::NOT_FOUND,
$allowedMethods ? \explode(',', \rtrim($allowedMethods, ',')) : []
];
}

/**
Expand Down

0 comments on commit 1aef8f2

Please sign in to comment.