don't leave HomeDocument body as string
diff --git a/openstack/cdn/v1/base/results.go b/openstack/cdn/v1/base/results.go
index da6ad2f..bef1da8 100644
--- a/openstack/cdn/v1/base/results.go
+++ b/openstack/cdn/v1/base/results.go
@@ -1,7 +1,8 @@
package base
import (
- "github.com/mitchellh/mapstructure"
+ "errors"
+
"github.com/rackspace/gophercloud"
)
@@ -19,13 +20,13 @@
return nil, r.Err
}
- var res struct {
- HomeDocument *HomeDocument `mapstructure:"resources"`
+ submap, ok := r.Body.(map[string]interface{})["resources"]
+ if !ok {
+ return nil, errors.New("Unexpected HomeDocument structure")
}
+ casted := HomeDocument(submap.(map[string]interface{}))
- err := mapstructure.Decode(r.Body, &res)
-
- return res.HomeDocument, err
+ return &casted, nil
}
// PingResult represents the result of a Ping operation.