Skip to content

Commit 546164f

Browse files
committed
Remove trailing slash on uri...
1 parent cfc9a46 commit 546164f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/WaterPipe/HTTP/Request/RequestUri.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function setPattern(string $pattern): RequestUri
7979
*/
8080
public function setUri(string $uri): RequestUri
8181
{
82-
$this->_uri = $uri;
82+
$this->_uri = "/" . trim($uri, "/");
8383
return $this;
8484
}
8585

@@ -148,7 +148,7 @@ public function isBuilt(): bool
148148
public static function isMatch(string $pattern, string $uri): bool
149149
{
150150
$pattern = self::pattern2regex($pattern);
151-
return preg_match("#^{$pattern}\$#", $uri) != false;
151+
return preg_match("#^{$pattern}\$#", "/" . trim($uri, "/")) != false;
152152
}
153153

154154
private static function _getUriParams(string $pattern): array

0 commit comments

Comments
 (0)