bump(github.com/rackspace/gophercloud): e00690e87603abe613e9f02c816c7c4bef82e063

This commit is contained in:
Mathieu Velten
2016-09-06 16:52:42 +02:00
parent 92cb90fc5d
commit 8ea400b1bf
10 changed files with 590 additions and 221 deletions

View File

@@ -102,6 +102,14 @@ type RequestOpts struct {
MoreHeaders map[string]string
}
func (opts *RequestOpts) setBody(body interface{}) {
if v, ok := (body).(io.ReadSeeker); ok {
opts.RawBody = v
} else if body != nil {
opts.JSONBody = body
}
}
// UnexpectedResponseCodeError is returned by the Request method when a response code other than
// those listed in OkCodes is encountered.
type UnexpectedResponseCodeError struct {
@@ -268,16 +276,12 @@ func (client *ProviderClient) Get(url string, JSONResponse *interface{}, opts *R
return client.Request("GET", url, *opts)
}
func (client *ProviderClient) Post(url string, JSONBody interface{}, JSONResponse *interface{}, opts *RequestOpts) (*http.Response, error) {
func (client *ProviderClient) Post(url string, body interface{}, JSONResponse *interface{}, opts *RequestOpts) (*http.Response, error) {
if opts == nil {
opts = &RequestOpts{}
}
if v, ok := (JSONBody).(io.ReadSeeker); ok {
opts.RawBody = v
} else if JSONBody != nil {
opts.JSONBody = JSONBody
}
opts.setBody(body)
if JSONResponse != nil {
opts.JSONResponse = JSONResponse
@@ -286,16 +290,12 @@ func (client *ProviderClient) Post(url string, JSONBody interface{}, JSONRespons
return client.Request("POST", url, *opts)
}
func (client *ProviderClient) Put(url string, JSONBody interface{}, JSONResponse *interface{}, opts *RequestOpts) (*http.Response, error) {
func (client *ProviderClient) Put(url string, body interface{}, JSONResponse *interface{}, opts *RequestOpts) (*http.Response, error) {
if opts == nil {
opts = &RequestOpts{}
}
if v, ok := (JSONBody).(io.ReadSeeker); ok {
opts.RawBody = v
} else if JSONBody != nil {
opts.JSONBody = JSONBody
}
opts.setBody(body)
if JSONResponse != nil {
opts.JSONResponse = JSONResponse