Update vendor

This commit is contained in:
James Jeffrey
2017-07-19 15:43:53 -07:00
parent 06505cef17
commit f9a46f7c1c
30 changed files with 1131 additions and 160 deletions

View File

@@ -87,6 +87,8 @@ type Client struct {
RetryWaitTime time.Duration
RetryMaxWaitTime time.Duration
RetryConditions []RetryConditionFunc
JSONMarshal func(v interface{}) ([]byte, error)
JSONUnmarshal func(data []byte, v interface{}) error
httpClient *http.Client
transport *http.Transport
@@ -811,6 +813,7 @@ func IsXMLType(ct string) bool {
}
// Unmarshal content into object from JSON or XML
// Deprecated: kept for backward compatibility
func Unmarshal(ct string, b []byte, d interface{}) (err error) {
if IsJSONType(ct) {
err = json.Unmarshal(b, d)
@@ -821,6 +824,17 @@ func Unmarshal(ct string, b []byte, d interface{}) (err error) {
return
}
// Unmarshalc content into object from JSON or XML
func Unmarshalc(c *Client, ct string, b []byte, d interface{}) (err error) {
if IsJSONType(ct) {
err = c.JSONUnmarshal(b, d)
} else if IsXMLType(ct) {
err = xml.Unmarshal(b, d)
}
return
}
func getLogger(w io.Writer) *log.Logger {
return log.New(w, "RESTY ", log.LstdFlags)
}