Browse Source

Don't force `/` on people when path is passed

Rachman Chavik 8 years ago
parent
commit
698a4f70f9
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/Routing/RouteBuilder.php
  2. 1 1
      tests/TestCase/Routing/RouteBuilderTest.php

+ 1 - 1
src/Routing/RouteBuilder.php

@@ -613,7 +613,7 @@ class RouteBuilder
         }
         $name = Inflector::underscore($name);
         if (isset($params['path'])) {
-            $path = ($params['path'][0] === '/' ? '' : '/') . $params['path'];
+            $path = $params['path'];
             unset($params['path']);
         } else {
             $path = '/' . $name;

+ 1 - 1
tests/TestCase/Routing/RouteBuilderTest.php

@@ -359,7 +359,7 @@ class RouteBuilderTest extends TestCase
     {
         $routes = new RouteBuilder($this->collection, '/admin', ['prefix' => 'admin']);
         $res = $routes->prefix('api', function ($r) {
-            $r->prefix('v10', ['path' => 'v1.0'], function ($r2) {
+            $r->prefix('v10', ['path' => '/v1.0'], function ($r2) {
                 $this->assertEquals('/admin/api/v1.0', $r2->path());
                 $this->assertEquals(['prefix' => 'admin/api/v10'], $r2->params());
                 $r2->prefix('b1', ['path' => '/beta.1'], function ($r3) {