add 'ExtractHeader' method to object storage return types
diff --git a/openstack/objectstorage/v1/accounts/results.go b/openstack/objectstorage/v1/accounts/results.go
index ba379eb..b254db9 100644
--- a/openstack/objectstorage/v1/accounts/results.go
+++ b/openstack/objectstorage/v1/accounts/results.go
@@ -1,14 +1,23 @@
package accounts
import (
+ "net/http"
"strings"
"github.com/rackspace/gophercloud"
)
+type headerResult struct {
+ gophercloud.Result
+}
+
+func (hr headerResult) ExtractHeader() (http.Header, error) {
+ return hr.Header, hr.Err
+}
+
// GetResult is returned from a call to the Get function.
type GetResult struct {
- gophercloud.Result
+ headerResult
}
// ExtractMetadata is a function that takes a GetResult (of type *http.Response)
@@ -30,5 +39,5 @@
// UpdateResult is returned from a call to the Update function.
type UpdateResult struct {
- gophercloud.Result
+ headerResult
}
diff --git a/openstack/objectstorage/v1/containers/results.go b/openstack/objectstorage/v1/containers/results.go
index f7f84c3..b0f2bd7 100644
--- a/openstack/objectstorage/v1/containers/results.go
+++ b/openstack/objectstorage/v1/containers/results.go
@@ -2,6 +2,7 @@
import (
"fmt"
+ "net/http"
"strings"
"github.com/rackspace/gophercloud"
@@ -96,13 +97,17 @@
}
}
-type commonResult struct {
+type headerResult struct {
gophercloud.Result
}
+func (hr headerResult) ExtractHeader() (http.Header, error) {
+ return hr.Header, hr.Err
+}
+
// GetResult represents the result of a get operation.
type GetResult struct {
- commonResult
+ headerResult
}
// ExtractMetadata is a function that takes a GetResult (of type *http.Response)
@@ -125,19 +130,19 @@
// the headers from the HTTP response, you can invoke the 'ExtractHeaders'
// method on the result struct.
type CreateResult struct {
- commonResult
+ headerResult
}
// UpdateResult represents the result of an update operation. To extract the
// the headers from the HTTP response, you can invoke the 'ExtractHeaders'
// method on the result struct.
type UpdateResult struct {
- commonResult
+ headerResult
}
// DeleteResult represents the result of a delete operation. To extract the
// the headers from the HTTP response, you can invoke the 'ExtractHeaders'
// method on the result struct.
type DeleteResult struct {
- gophercloud.ExtractErrResult
+ headerResult
}
diff --git a/openstack/objectstorage/v1/objects/requests.go b/openstack/objectstorage/v1/objects/requests.go
index f5ca296..56004b2 100644
--- a/openstack/objectstorage/v1/objects/requests.go
+++ b/openstack/objectstorage/v1/objects/requests.go
@@ -303,11 +303,12 @@
url += query
}
- _, res.Err = perigee.Request("DELETE", url, perigee.Options{
+ resp, err := perigee.Request("DELETE", url, perigee.Options{
MoreHeaders: c.AuthenticatedHeaders(),
OkCodes: []int{204},
})
-
+ res.Header = resp.HttpResponse.Header
+ res.Err = err
return res
}
diff --git a/openstack/objectstorage/v1/objects/results.go b/openstack/objectstorage/v1/objects/results.go
index 97a6f91..7524c43 100644
--- a/openstack/objectstorage/v1/objects/results.go
+++ b/openstack/objectstorage/v1/objects/results.go
@@ -4,6 +4,7 @@
"fmt"
"io"
"io/ioutil"
+ "net/http"
"strings"
"github.com/rackspace/gophercloud"
@@ -97,13 +98,17 @@
}
}
-type commonResult struct {
+type headerResult struct {
gophercloud.Result
}
+func (hr headerResult) ExtractHeader() (http.Header, error) {
+ return hr.Header, hr.Err
+}
+
// DownloadResult is a *http.Response that is returned from a call to the Download function.
type DownloadResult struct {
- commonResult
+ headerResult
Body io.Reader
}
@@ -125,7 +130,7 @@
// GetResult is a *http.Response that is returned from a call to the Get function.
type GetResult struct {
- commonResult
+ headerResult
}
// ExtractMetadata is a function that takes a GetResult (of type *http.Response)
@@ -146,20 +151,20 @@
// CreateResult represents the result of a create operation.
type CreateResult struct {
- commonResult
+ headerResult
}
// UpdateResult represents the result of an update operation.
type UpdateResult struct {
- commonResult
+ headerResult
}
// DeleteResult represents the result of a delete operation.
type DeleteResult struct {
- gophercloud.ExtractErrResult
+ headerResult
}
// CopyResult represents the result of a copy operation.
type CopyResult struct {
- commonResult
+ headerResult
}