Lots of URL normalization.
So it doesn't matter if you have a trailing / or not.
diff --git a/openstack/utils/choose_version.go b/openstack/utils/choose_version.go
index 57e2a81..402a870 100644
--- a/openstack/utils/choose_version.go
+++ b/openstack/utils/choose_version.go
@@ -75,18 +75,19 @@
}
return endpoint
}
+ normalizedGiven := normalize(identityEndpoint)
for _, value := range resp.Versions.Values {
href := ""
for _, link := range value.Links {
if link.Rel == "self" {
- href = link.Href
+ href = normalize(link.Href)
}
}
if matching, ok := byID[value.ID]; ok {
// Prefer a version that exactly matches the provided endpoint.
- if normalize(href) == normalize(identityEndpoint) {
+ if href == normalizedGiven {
if href == "" {
return nil, "", fmt.Errorf("Endpoint missing in version %s response from %s", value.ID, normalized)
}