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

fix allow-head to include name on route #1737

Merged
merged 1 commit into from
Mar 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions aiohttp/web_urldispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,9 +859,10 @@ def add_get(self, *args, name=None, allow_head=True, **kwargs):
route is added allowing head requests to the same endpoint
"""
if allow_head:
# the head route can't have "name" set or it would conflict with
# it name is not None append -head to avoid it conflicting with
# the GET route below
self.add_route(hdrs.METH_HEAD, *args, **kwargs)
head_name = name and '{}-head'.format(name)
self.add_route(hdrs.METH_HEAD, *args, name=head_name, **kwargs)
return self.add_route(hdrs.METH_GET, *args, name=name, **kwargs)

def add_post(self, *args, **kwargs):
Expand Down