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

If the 'body' returned by a Lambda function is a number, don't choke. #39

Merged
merged 1 commit into from
Aug 14, 2017
Merged

If the 'body' returned by a Lambda function is a number, don't choke. #39

merged 1 commit into from
Aug 14, 2017

Conversation

PaulMaddox
Copy link
Contributor

This uses the json encoding package json.Number type to transparently
work with both a number and/or a string. If it's a number, the json
encoding will convert it to a string.

See:
http://igorsobreira.com/2015/04/11/decoding-json-numbers-into-strings-in-go.html

Fixes #38.

This uses the json encoding package's json.Number type to transparently
work with both a number and/or a string. If it's a number, the json
encoding will convert it to a string.

See:
http://igorsobreira.com/2015/04/11/decoding-json-numbers-into-strings-in-go.html

Fixes #38.
@PaulMaddox PaulMaddox requested a review from sanathkr August 14, 2017 15:56
@sanathkr sanathkr merged commit 8c47aee into aws:develop Aug 14, 2017
@sanathkr
Copy link
Contributor

Can you double check if this body is used anywhere? It can't be assigned to a string anymore after unmarshalling

@PaulMaddox
Copy link
Contributor Author

No, the proxy object doesn't leave that method's scope.

It's accessed twice within that method:

  1. To check if a body has been passed: https://github.com/awslabs/aws-sam-local/blob/8c47aee7d04617b02b09486c8a605ec07d33c862/start.go#L190

  2. To write the body out to the HTTP response:
    https://github.com/awslabs/aws-sam-local/blob/8c47aee7d04617b02b09486c8a605ec07d33c862/start.go#L212

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