Skip to content

Commit

Permalink
Fix the mechanism that matches routes against the request method.
Browse files Browse the repository at this point in the history
Closes #118
  • Loading branch information
trq committed Aug 17, 2012
1 parent 611baa3 commit 711f479
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/Proem/Routing/Route/Standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,17 @@ public function process(Request $request)
$rule = $this->options['rule'];
$target = isset($this->options['targets']) ? $this->options['targets'] : [];
$custom_filters = isset($this->options['filters']) ? $this->options['filters'] : [];
$method = isset($this->options['method']) ? $this->options['method'] : 'GET';
$method = isset($this->options['method']) ? $this->options['method'] : false;

$requestMethod = $request->getMethod();

if ($method && (strtoupper($method) !== strtoupper($requestMethod))) {
return false;
}

$default_tokens = $this->default_tokens;
$default_filters = $this->default_filters;
$uri = $request->getRequestUri();
$requestMethod = $request->getMethod();

$keys = [];
$values = [];
Expand Down Expand Up @@ -150,7 +155,7 @@ function($matches) use ($custom_filters, $default_tokens, $default_filters)
$rule
) . '/?';

if (preg_match('@^' . $regex . '$@', $request->getRequestUri(), $values) && $requestMethod == $method) {
if (preg_match('@^' . $regex . '$@', $request->getRequestUri(), $values)) {
array_shift($values);

foreach ($keys as $index => $value) {
Expand Down

0 comments on commit 711f479

Please sign in to comment.