Skip to content

Commit

Permalink
Add json.Number parsing for iam_request_header values
Browse files Browse the repository at this point in the history
Fixes #3763
  • Loading branch information
jefferai committed Jan 9, 2018
1 parent c9e5cd5 commit 9b13355
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions builtin/credential/aws/path_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/subtle"
"crypto/x509"
"encoding/base64"
"encoding/json"
"encoding/pem"
"encoding/xml"
"fmt"
Expand Down Expand Up @@ -1467,11 +1468,15 @@ func parseIamRequestHeaders(headersB64 string) (http.Header, error) {
switch typedValue := v.(type) {
case string:
headers.Add(k, typedValue)
case json.Number:
headers.Add(k, typedValue.String())
case []interface{}:
for _, individualVal := range typedValue {
switch possibleStrVal := individualVal.(type) {
case string:
headers.Add(k, possibleStrVal)
case json.Number:
headers.Add(k, possibleStrVal.String())
default:
return nil, fmt.Errorf("header %q contains value %q that has type %s, not string", k, individualVal, reflect.TypeOf(individualVal))
}
Expand Down

0 comments on commit 9b13355

Please sign in to comment.