From 07b31bea03739826cf7b552d8d8bb04ab2707e6d Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Mon, 6 Aug 2012 13:31:53 -0400 Subject: [PATCH] Fixed issue with // in some cases. We now normalize the endpoint so it does not have a trailing /. --- src/HPCloud/Services/IdentityServices.php | 2 +- test/Tests/IdentityServicesTest.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/HPCloud/Services/IdentityServices.php b/src/HPCloud/Services/IdentityServices.php index 4f56bcf..e0fa680 100644 --- a/src/HPCloud/Services/IdentityServices.php +++ b/src/HPCloud/Services/IdentityServices.php @@ -209,7 +209,7 @@ class IdentityServices /*implements Serializable*/ { $parts = parse_url($url); if (!empty($parts['path'])) { - $this->endpoint = $url; + $this->endpoint = rtrim($url, '/'); } else { $this->endpoint = rtrim($url, '/') . '/v' . self::API_VERSION; diff --git a/test/Tests/IdentityServicesTest.php b/test/Tests/IdentityServicesTest.php index ec0c783..37d844c 100644 --- a/test/Tests/IdentityServicesTest.php +++ b/test/Tests/IdentityServicesTest.php @@ -53,7 +53,9 @@ class IdentityServicesTest extends \HPCloud\Tests\TestCase { $endpoint = self::conf('hpcloud.identity.url'); $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; }