diff --git a/src/Router.php b/src/Router.php index b60409f..b75d962 100644 --- a/src/Router.php +++ b/src/Router.php @@ -74,7 +74,7 @@ public function handleRequest(Request $request): Response } $method = $request->getMethod(); - $path = \rawurldecode($request->getUri()->getPath()); + $path = $request->getUri()->getPath(); $toMatch = "{$method}\0{$path}"; diff --git a/test/RouterTest.php b/test/RouterTest.php index 0fd7b8d..532ac25 100644 --- a/test/RouterTest.php +++ b/test/RouterTest.php @@ -207,18 +207,18 @@ public function testMerge(): void $this->assertEquals(HttpStatus::NOT_FOUND, $response->getStatus()); } - public function testPathIsMatchedDecoded(): void + public function testPathMatchIsEncoded(): void { $requestHandler = new ClosureRequestHandler(function () { return new Response(HttpStatus::OK); }); $router = new Router($this->server, $this->testLogger, $this->errorHandler); - $router->addRoute("GET", "/fo+ö", $requestHandler); + $router->addRoute("GET", "/fo+" . \rawurlencode("/ö"), $requestHandler); $this->server->start($router, $this->errorHandler); - $uri = "/fo+" . \rawurlencode("ö"); + $uri = "/fo+" . \rawurlencode("/ö"); $request = new Request($this->createMock(Client::class), "GET", Uri\Http::createFromString($uri)); $response = $router->handleRequest($request);