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

feat: provide the options to set arbitrary json encoder and decoder options #513

Closed

Conversation

MatthewDolan
Copy link

@MatthewDolan MatthewDolan commented Jul 19, 2023

Issue #: #514

Description of changes:

Before this change, the lambda API supported setting some of the json encoder options (SetEscapeHTML(...) & SetIndent(...)). I needed the ability to set the UseNumber() option on the decoder and I considered setting it in the same way (by creating a one-off option), but instead I ended up creating two new options that allow setting arbitrary fields on the encoder and decoder.

I think this is a better option because it's future-proof (if new options are added to the json library, this library won't also need to be changed to make this option available) and more backward compatible.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

codecov-commenter commented Jul 19, 2023

Codecov Report

Merging #513 (a9dc75a) into main (771b391) will increase coverage by 0.23%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #513      +/-   ##
==========================================
+ Coverage   72.63%   72.86%   +0.23%     
==========================================
  Files          26       26              
  Lines        1407     1419      +12     
==========================================
+ Hits         1022     1034      +12     
  Misses        314      314              
  Partials       71       71              
Files Changed Coverage Δ
lambda/handler.go 95.85% <100.00%> (+0.27%) ⬆️

@MatthewDolan
Copy link
Author

@bmoffatt, I would be curious to hear your feedback on this change. Thank you.

@MatthewDolan MatthewDolan deleted the dolan-2023-07-19-json-options branch August 15, 2023 23:19
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