Refactor OpenStack services to use default OkCodes
diff --git a/openstack/objectstorage/v1/accounts/requests.go b/openstack/objectstorage/v1/accounts/requests.go
index 3e404c3..a645115 100644
--- a/openstack/objectstorage/v1/accounts/requests.go
+++ b/openstack/objectstorage/v1/accounts/requests.go
@@ -95,7 +95,7 @@
resp, err := c.Request("POST", updateURL(c), gophercloud.RequestOpts{
MoreHeaders: h,
- OkCodes: []int{204},
+ OkCodes: []int{201, 202, 204},
})
res.Header = resp.Header
res.Err = err
diff --git a/openstack/objectstorage/v1/containers/requests.go b/openstack/objectstorage/v1/containers/requests.go
index a29d7da..39dd4d3 100644
--- a/openstack/objectstorage/v1/containers/requests.go
+++ b/openstack/objectstorage/v1/containers/requests.go
@@ -122,9 +122,7 @@
// Delete is a function that deletes a container.
func Delete(c *gophercloud.ServiceClient, containerName string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", deleteURL(c, containerName), gophercloud.RequestOpts{
- OkCodes: []int{202, 204},
- })
+ _, res.Err = c.Request("DELETE", deleteURL(c, containerName), gophercloud.RequestOpts{})
return res
}
@@ -180,7 +178,7 @@
resp, err := c.Request("POST", updateURL(c, containerName), gophercloud.RequestOpts{
MoreHeaders: h,
- OkCodes: []int{202, 204},
+ OkCodes: []int{201, 202, 204},
})
res.Header = resp.Header
res.Err = err
diff --git a/openstack/objectstorage/v1/objects/requests.go b/openstack/objectstorage/v1/objects/requests.go
index 30ea94c..b69b8dd 100644
--- a/openstack/objectstorage/v1/objects/requests.go
+++ b/openstack/objectstorage/v1/objects/requests.go
@@ -211,7 +211,6 @@
ropts := gophercloud.RequestOpts{
RawBody: content,
MoreHeaders: h,
- OkCodes: []int{201, 202},
}
resp, err := c.Request("PUT", url, ropts)
@@ -310,9 +309,7 @@
url += query
}
- resp, err := c.Request("DELETE", url, gophercloud.RequestOpts{
- OkCodes: []int{204},
- })
+ resp, err := c.Request("DELETE", url, gophercloud.RequestOpts{})
res.Header = resp.Header
res.Err = err
return res
@@ -412,7 +409,6 @@
url := updateURL(c, containerName, objectName)
resp, err := c.Request("POST", url, gophercloud.RequestOpts{
MoreHeaders: h,
- OkCodes: []int{202},
})
res.Header = resp.Header
res.Err = err