-
-
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
Raise ContentTypeError by json() when headers does not … #2136
Raise ContentTypeError by json() when headers does not … #2136
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2136 +/- ##
==========================================
+ Coverage 97.07% 97.07% +<.01%
==========================================
Files 38 38
Lines 7723 7728 +5
Branches 1346 1347 +1
==========================================
+ Hits 7497 7502 +5
Misses 102 102
Partials 124 124
Continue to review full report at Codecov.
|
The intention is pretty clean but |
Exception name changed to |
Thanks! |
What do these changes do?
Basically, avoid having a nocive fall back as the following one
The
ClieintResponseError
can be raised by many reasons, and the case presented the fallback can be misleading having as a result twiceClieintResponseError
because the source of the problem wasn't related to the content type.With an ad-hoc exception, the client can code a more specific fallback case taking into account the differents source of problems with a cleaner interface, for example:
Thanks to the current
json()
implementation once we have had aContentTypeError
exception is not possible to have aClieintResponseError
. Therefore, the developer can handle the errors as the previous example.For backward compatibility the
ContentTypeError
inherits fromClieintResponseError
.Are there changes in behavior for the user?
No
Checklist
CONTRIBUTORS.txt
changes
folder<issue_id>.<type>
for example (588.bug)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.