Skip to content

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

Merged
sanathkr merged 1 commit into
aws:developfrom
PaulMaddox:develop
Aug 14, 2017
Merged

sanathkr merged 1 commit into
aws:developfrom
PaulMaddox:develop

Conversation

@PaulMaddox

Copy link
Copy Markdown
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
Copy Markdown

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

@PaulMaddox

Copy link
Copy Markdown
Contributor Author

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