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

Cleanup response.json() method. #2911

Merged
merged 3 commits into from Oct 31, 2023
Merged

Cleanup response.json() method. #2911

merged 3 commits into from Oct 31, 2023

Conversation

tomchristie
Copy link
Member

The Response.json() method appears unnecessarily complicated, I think this is a historical appendix that can be surgically tidied up. The stdlib implementation of json.loads already includes the charset detection that we're currently providing with our internal guess_json_utf() function.

  • Switch test_utils to use a public API for testing JSON utf-8 encodings.
  • Remove the internal guess_json_utf() function.
  • Simpliy the Response.json() method.

@tomchristie tomchristie added the refactor Issues and PRs related to code refactoring label Oct 30, 2023
@tomchristie tomchristie marked this pull request as ready for review October 30, 2023 14:36
Copy link
Contributor

@T-256 T-256 left a comment

Choose a reason for hiding this comment

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

Agree with this change.
No more need _guess_content_json_utf at #2851.

@T-256
Copy link
Contributor

T-256 commented Oct 30, 2023

#2851 now included this change, can you review that? I think we can merge #2851 instead of this PR.

@tomchristie
Copy link
Member Author

can you review that?

👍

@tomchristie tomchristie merged commit 1d73150 into master Oct 31, 2023
5 checks passed
@tomchristie tomchristie deleted the cleanup-json-decoding branch October 31, 2023 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Issues and PRs related to code refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants