Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 14c8801

Browse files
committed
Fix for issue#533
1 parent 6769c3b commit 14c8801

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

openstack/blockstorage/v1/apiversions/urls.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package apiversions
22

33
import (
44
"strings"
5+
"net/url"
56

67
"github.com/rackspace/gophercloud"
78
)
@@ -11,5 +12,7 @@ func getURL(c *gophercloud.ServiceClient, version string) string {
1112
}
1213

1314
func listURL(c *gophercloud.ServiceClient) string {
14-
return c.ServiceURL("")
15+
u, _ := url.Parse(c.ServiceURL(""))
16+
u.Path = "/"
17+
return u.String()
1518
}

openstack/blockstorage/v1/apiversions/urls_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,24 @@ import (
88
)
99

1010
const endpoint = "http://localhost:57909/"
11+
const endpoint2 = "http://localhost:57909/v1/3a02ee0b5cf14816b41b17e851d29a94"
1112

1213
func endpointClient() *gophercloud.ServiceClient {
1314
return &gophercloud.ServiceClient{Endpoint: endpoint}
1415
}
1516

17+
func endpointClient2() *gophercloud.ServiceClient {
18+
return &gophercloud.ServiceClient{Endpoint: endpoint2}
19+
}
20+
1621
func TestGetURL(t *testing.T) {
1722
actual := getURL(endpointClient(), "v1")
1823
expected := endpoint + "v1/"
1924
th.AssertEquals(t, expected, actual)
2025
}
2126

2227
func TestListURL(t *testing.T) {
23-
actual := listURL(endpointClient())
28+
actual := listURL(endpointClient2())
2429
expected := endpoint
2530
th.AssertEquals(t, expected, actual)
2631
}

0 commit comments

Comments
 (0)