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

JSON encoder change via app #2055

Merged
merged 11 commits into from
Mar 11, 2021
Merged

JSON encoder change via app #2055

merged 11 commits into from
Mar 11, 2021

Conversation

ahopkins
Copy link
Member

@ahopkins ahopkins commented Mar 10, 2021

Resolves #2054


This one has come up a few times in the past. The current method for setting this at the default level by only looking at the environment is not ideal.

Adds the following API to set the encoder globally.

Sanic(..., dumps=my_favorite_json_encoder)

@ahopkins ahopkins requested a review from a team as a code owner March 10, 2021 08:33
@ahopkins ahopkins changed the title 2054 json encoder JSON encoder #2054 Mar 10, 2021
@ahopkins ahopkins changed the title JSON encoder #2054 JSON encoder change via app Mar 10, 2021
@codecov
Copy link

codecov bot commented Mar 10, 2021

Codecov Report

Merging #2055 (9039319) into master (d76925c) will increase coverage by 0.012%.
The diff coverage is 100.000%.

Impacted file tree graph

@@              Coverage Diff              @@
##            master     #2055       +/-   ##
=============================================
+ Coverage   91.995%   92.007%   +0.012%     
=============================================
  Files           36        36               
  Lines         3298      3303        +5     
  Branches       562       564        +2     
=============================================
+ Hits          3034      3039        +5     
  Misses         179       179               
  Partials        85        85               
Impacted Files Coverage Δ
sanic/blueprint_group.py 100.000% <ø> (ø)
sanic/app.py 91.525% <100.000%> (+0.036%) ⬆️
sanic/blueprints.py 100.000% <100.000%> (ø)
sanic/models/futures.py 100.000% <100.000%> (ø)
sanic/response.py 94.737% <100.000%> (+0.106%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d76925c...9039319. Read the comment docs.

@ahopkins ahopkins requested a review from a team March 10, 2021 20:42
Copy link
Contributor

@harshanarayana harshanarayana left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for taking care of some of the import sorting issues.

@ahopkins
Copy link
Member Author

Thanks isort 🤘

@ahopkins ahopkins merged commit b1a57a8 into master Mar 11, 2021
@ahopkins ahopkins deleted the 2054-json-encoder branch March 11, 2021 15:09
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.

Universal JSON encoder change
2 participants