-
-
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
Web exceptions refactoring #3462
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGFM, except few moments.
Codecov Report
@@ Coverage Diff @@
## master #3462 +/- ##
==========================================
- Coverage 97.94% 97.89% -0.05%
==========================================
Files 44 44
Lines 8562 8665 +103
Branches 1381 1417 +36
==========================================
+ Hits 8386 8483 +97
- Misses 71 75 +4
- Partials 105 107 +2
Continue to review full report at Codecov.
|
self.headers['Allow'] = allow | ||
self.allowed_methods = set(allowed_methods) # type: Set[str] | ||
self.method = method.upper() | ||
self._allowed = set(allowed_methods) # type: Set[str] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should allowed_methods
be uppercased as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question.
HTTP verbs are case sensitive by RFC.
Maybe even method.upper()
is redundant.
aiohttp dispatcher never raises the lowercased method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. I'd say that method must never be transformed on the low level of the framework, normalization may be optional for dispatching calls to class-based views.
In Cheroot I return 400 Bad Request immediately as per RFCs: https://github.com/cherrypy/cheroot/blob/cf738c4/cheroot/server.py#L792-L802
@webknjaz thanks for the review. |
Everything is done from my perspective |
Don't inherit
web.HTTPException
fromResponse