-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Accept an errors parameter for text decoding ClientResponses #1542
Accept an errors parameter for text decoding ClientResponses #1542
Conversation
Current coverage is 98.91% (diff: 100%)@@ master #1542 diff @@
==========================================
Files 30 30
Lines 6995 6989 -6
Methods 0 0
Messages 0 0
Branches 1169 1162 -7
==========================================
- Hits 6920 6913 -7
Misses 37 37
- Partials 38 39 +1
|
Could you add test for this change? |
@fafhrd91 sure - what would you like to be tested though? This is a pretty inconsequential change that just passes another optional parameter down to Python std lib call. |
test that |
1a4ae3c
to
9c7f964
Compare
OK - let me know if there's anything else you need @fafhrd91 |
great! thanks |
What do these changes do?
Users can now give a parameter specifying what should happen to decoding errors when asking for the
text()
from aClientResponse
. This is passed directly into the bytes() decode method.The internet is full of websites that have incorrectly specified their character encoding or that have one or two characters on a page that are not encoded correctly. Right now, the
aiohttp
library just throws an exception when this happens - for a more resilient solution, users should be able to optionally provide an alternative error handling strategy for incorrectly encoded characters.Are there changes in behavior for the user?
Nope - just a new optional parameter.
Related issue number
Nope.
Checklist
CONTRIBUTORS.txt
CHANGES.rst
#issue_number
format at the end of changelog message. Use Pull Request number if there are no issues for PR or PR covers the issue only partially.