Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add json.Number parsing for iam_request_header values #3770

Merged
merged 2 commits into from
Jan 10, 2018
Merged

Conversation

jefferai
Copy link
Member

Fixes #3763

@jefferai jefferai added this to the 0.9.2 milestone Jan 10, 2018
@jefferai
Copy link
Member Author

Verified by reporter.

@jefferai jefferai merged commit 6f5f40f into master Jan 10, 2018
@jefferai jefferai deleted the aws-jsonnumber branch January 10, 2018 15:56
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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message and the one a few lines below are now incorrect since it also accepts json.Number.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joelthompson I actually thought about that and was about 60% leaving it this way and 40% changing it. The reason is twofold: one, technically json.Number is a special casing of a string inside Go with some extra parsing logic; the other is that headers are supposed to always be strings, so we are now accepting ints for content-length but it's still incorrect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants