Skip to content

Commit a47c801

Browse files
committed
Fix url space issue #1
1 parent d7c1963 commit a47c801

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

System/Router/Route.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ final class Route {
4949
*/
5050
public function __construct(String $method, String $pattern, $callback) {
5151
$this->method = $this->validateMethod(strtoupper($method));
52-
$this->pattern = $pattern;
52+
$this->pattern = cleanUrl($pattern);
5353
$this->callback = $callback;
5454
}
5555

@@ -60,7 +60,7 @@ private function validateMethod(string $method) {
6060
if (in_array(strtoupper($method), $this->list_method))
6161
return $method;
6262

63-
throw new Exception('Invalid Method Name');
63+
throw new Exception('Invalid Method Name');
6464
}
6565

6666
/**

System/Router/Router.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private function getMatchRoutersByRequestMethod() {
118118
private function getMatchRoutersByPattern($pattern) {
119119
$this->matchRouter = [];
120120
foreach ($pattern as $value) {
121-
if ($this->dispatch($this->url, $value->getPattern()))
121+
if ($this->dispatch(cleanUrl($this->url), $value->getPattern()))
122122
array_push($this->matchRouter, $value);
123123
}
124124
}

0 commit comments

Comments
 (0)