Fixed issue with // in some cases. We now normalize the endpoint so it does not have a trailing /.

This commit is contained in:
Matt Farina 2012-08-06 13:31:53 -04:00
parent 83604c466b
commit 07b31bea03
2 changed files with 4 additions and 2 deletions

View File

@ -209,7 +209,7 @@ class IdentityServices /*implements Serializable*/ {
$parts = parse_url($url); $parts = parse_url($url);
if (!empty($parts['path'])) { if (!empty($parts['path'])) {
$this->endpoint = $url; $this->endpoint = rtrim($url, '/');
} }
else { else {
$this->endpoint = rtrim($url, '/') . '/v' . self::API_VERSION; $this->endpoint = rtrim($url, '/') . '/v' . self::API_VERSION;

View File

@ -53,7 +53,9 @@ class IdentityServicesTest extends \HPCloud\Tests\TestCase {
$endpoint = self::conf('hpcloud.identity.url'); $endpoint = self::conf('hpcloud.identity.url');
$service = new IdentityServices($endpoint); $service = new IdentityServices($endpoint);
$this->assertStringStartsWith($endpoint, $service->url()); // If there is a trailing / we remove that from the endpoint. Our calls add
// the / back where appropriate.
$this->assertStringStartsWith(rtrim($endpoint, '/'), $service->url());
return $service; return $service;
} }