Make client return error on JSON decoding error
If the response is not valid JSON, the request simply returns an
empty body. If the user is expecting the result to be JSON and its
not, we should signal that an error has occured.
This patch also includes fixes to tests that fail due to the
error that bubbles up.
diff --git a/openstack/compute/v2/servers/requests.go b/openstack/compute/v2/servers/requests.go
index 63ad24b..f9839d9 100644
--- a/openstack/compute/v2/servers/requests.go
+++ b/openstack/compute/v2/servers/requests.go
@@ -754,9 +754,7 @@
// DeleteMetadatum will delete the key-value pair with the given key for the given server ID.
func DeleteMetadatum(client *gophercloud.ServiceClient, id, key string) DeleteMetadatumResult {
var res DeleteMetadatumResult
- _, res.Err = client.Delete(metadatumURL(client, id, key), &gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = client.Delete(metadatumURL(client, id, key), nil)
return res
}