Browse Source

Tests passing for adding basePath.

Eugene Ritter 5 years ago
parent
commit
b86daa5d2d
2 changed files with 4 additions and 2 deletions
  1. 3 1
      src/Http/Client.php
  2. 1 1
      tests/TestCase/Http/ClientTest.php

+ 3 - 1
src/Http/Client.php

@@ -548,7 +548,9 @@ class Client implements ClientInterface
         if ($options['port'] && (int)$options['port'] !== $defaultPorts[$options['scheme']]) {
             $out .= ':' . $options['port'];
         }
-        $out .= '/' . trim($options['basePath'], '/');
+        if (!empty($options['basePath'])) {
+            $out .= '/' . trim($options['basePath'], '/');
+        }
         $out .= '/' . ltrim($url, '/');
 
         return $out;

+ 1 - 1
tests/TestCase/Http/ClientTest.php

@@ -1003,7 +1003,7 @@ class ClientTest extends TestCase
             'host' => 'example.co',
             'port' => 80,
             'scheme' => 'http',
-            'basePath' => '/some/uri',
+            'basePath' => '/some/uri/',
             'timeout' => 30,
             'ssl_verify_peer' => true,
             'ssl_verify_peer_name' => true,