fix: make iter_content with decode_unicode=True return unicode strings#104
Open
label-hook[bot] wants to merge 2258 commits into
Open
fix: make iter_content with decode_unicode=True return unicode strings#104label-hook[bot] wants to merge 2258 commits into
label-hook[bot] wants to merge 2258 commits into
Conversation
advanced: use "client.*" to designate client certificate
…x_theme Switch to alabaster sphinx theme in the docs
distutils has been deprecated for years now and pip is refusing to install projects using it. As such, *some* users are reporting problems installing requests. Let's avoid this entirely by not falling back to distutils at all.
Stop falling back to distutils in setup.py
Return request & response with TooManyRedirects
Fix api doc of debug logging for Python 3
Warn about encrypted keys in the docs.
It seems it's necessary both in pulling all_proxy from the environment (rebuild_proxies) and deciding which proxy to use (select_proxy). Also added new functional test.
Fix to check for Plain ip notations in no_proxy settings if not CIDR
Support ALL_PROXY environment variable
So that failing tests don't cause the server thread to hang indefinitely, waiting for connections that will never come. Rationale for suppressing error/traceback from interrupted _accept_connection in testserver.Server: https://gist.github.com/brettdh/b6e741227b2297f19d2118077f14dfa5 * Move server socket close to just before join This way it handles the no-connections, no-exceptions case as well as the exception case. If the server thread doesn't exit by itself within 5 seconds of the context manager exit, the accept will be interrupted. * Address feedback - pytest.raises rather than except:pass - Move socket create/bind back to run() - Timeout on accepting connections
Encoding JSON requests to bytes for urllib3 to handle
* BaseAdapter definition of send is missing mandatory params * Copy over relevant parts of the interface documentation * Indentation fix * Change base class documentation for close
This is only a minor improvement on the great work of https://github.com/kennethreitz/requests/pull/2859 that permits to run tests on hosts without Internet connection.
Update documentation of Session.max_redirects
(not the button's fault!)
Update a note on AppEngine
Note how HTTPErrors are raised
Verify that the expected warnings are emitted with SubjectAltNameWarning emitted on all environments due to the https server provided by httpbin_secure.
Use xfail marker for a test expected to fail without Internet connection
Update list of supported Python versions in todo.rst
added in type check for chunk_size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an issue where
iter_content(decode_unicode=True)was returning bytes instead of unicode strings, making it inconsistent with thetextproperty behavior. Whendecode_unicode=Trueis specified, users expect to receive unicode strings, not bytes.Changes
iter_contentmethod inrequests/models.pyto properly decode bytes to unicode whendecode_unicode=Truestream_decode_response_unicodeutility function for consistent unicode decodingdecode_unicode=False(default)Testing
The fix was verified through manual testing that confirms:
iter_content(decode_unicode=True)now returns unicode strings instead of bytesiter_content(decode_unicode=False)continues to return bytes as expectediter_content(decode_unicode=True)matches the content from thetextpropertyCloses #103
Closes #103