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

Web exceptions refactoring #3462

Merged
merged 16 commits into from
Jan 14, 2019
Merged

Web exceptions refactoring #3462

merged 16 commits into from
Jan 14, 2019

Conversation

asvetlov
Copy link
Member

Don't inherit web.HTTPException from Response

aiohttp/web_exceptions.py Outdated Show resolved Hide resolved
Copy link
Member

@kxepal kxepal left a 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.

aiohttp/web_exceptions.py Outdated Show resolved Hide resolved
aiohttp/web_exceptions.py Show resolved Hide resolved
aiohttp/web_exceptions.py Outdated Show resolved Hide resolved
aiohttp/web_exceptions.py Outdated Show resolved Hide resolved
aiohttp/web_exceptions.py Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Dec 24, 2018

Codecov Report

Merging #3462 into master will decrease coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
aiohttp/web_protocol.py 91.69% <100%> (-0.67%) ⬇️
aiohttp/web_exceptions.py 100% <100%> (ø) ⬆️
aiohttp/web_middlewares.py 100% <100%> (ø) ⬆️
aiohttp/web_fileresponse.py 96.55% <0%> (-1.15%) ⬇️
aiohttp/web_response.py 97.73% <0%> (-0.46%) ⬇️
aiohttp/streams.py 98.86% <0%> (+0.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a86af67...166c3b7. Read the comment docs.

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]
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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

@asvetlov
Copy link
Member Author

@webknjaz thanks for the review.
Now I'm working on the documentation update.
Will address notes a little later.

@asvetlov
Copy link
Member Author

Everything is done from my perspective

@asvetlov asvetlov merged commit c11e891 into master Jan 14, 2019
@asvetlov asvetlov deleted the web-exceptions-refactoring branch January 14, 2019 15:46
@lock
Copy link

lock bot commented Jan 14, 2020

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Jan 14, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 14, 2020
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Jan 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bot:chronographer:provided There is a change note present in this PR outdated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants