diff options
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go index 7a779ee..33fd53b 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go | |||
@@ -3,7 +3,6 @@ package rest | |||
3 | import ( | 3 | import ( |
4 | "bytes" | 4 | "bytes" |
5 | "encoding/base64" | 5 | "encoding/base64" |
6 | "encoding/json" | ||
7 | "fmt" | 6 | "fmt" |
8 | "io" | 7 | "io" |
9 | "io/ioutil" | 8 | "io/ioutil" |
@@ -16,6 +15,7 @@ import ( | |||
16 | "github.com/aws/aws-sdk-go/aws" | 15 | "github.com/aws/aws-sdk-go/aws" |
17 | "github.com/aws/aws-sdk-go/aws/awserr" | 16 | "github.com/aws/aws-sdk-go/aws/awserr" |
18 | "github.com/aws/aws-sdk-go/aws/request" | 17 | "github.com/aws/aws-sdk-go/aws/request" |
18 | "github.com/aws/aws-sdk-go/private/protocol" | ||
19 | ) | 19 | ) |
20 | 20 | ||
21 | // UnmarshalHandler is a named request handler for unmarshaling rest protocol requests | 21 | // UnmarshalHandler is a named request handler for unmarshaling rest protocol requests |
@@ -198,23 +198,21 @@ func unmarshalHeader(v reflect.Value, header string, tag reflect.StructTag) erro | |||
198 | } | 198 | } |
199 | v.Set(reflect.ValueOf(&f)) | 199 | v.Set(reflect.ValueOf(&f)) |
200 | case *time.Time: | 200 | case *time.Time: |
201 | t, err := time.Parse(RFC822, header) | 201 | format := tag.Get("timestampFormat") |
202 | if len(format) == 0 { | ||
203 | format = protocol.RFC822TimeFormatName | ||
204 | } | ||
205 | t, err := protocol.ParseTime(format, header) | ||
202 | if err != nil { | 206 | if err != nil { |
203 | return err | 207 | return err |
204 | } | 208 | } |
205 | v.Set(reflect.ValueOf(&t)) | 209 | v.Set(reflect.ValueOf(&t)) |
206 | case aws.JSONValue: | 210 | case aws.JSONValue: |
207 | b := []byte(header) | 211 | escaping := protocol.NoEscape |
208 | var err error | ||
209 | if tag.Get("location") == "header" { | 212 | if tag.Get("location") == "header" { |
210 | b, err = base64.StdEncoding.DecodeString(header) | 213 | escaping = protocol.Base64Escape |
211 | if err != nil { | ||
212 | return err | ||
213 | } | ||
214 | } | 214 | } |
215 | 215 | m, err := protocol.DecodeJSONValue(header, escaping) | |
216 | m := aws.JSONValue{} | ||
217 | err = json.Unmarshal(b, &m) | ||
218 | if err != nil { | 216 | if err != nil { |
219 | return err | 217 | return err |
220 | } | 218 | } |