Skip to content
Merged
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions sanic/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ def get(self, request: Request):
to `"/v"`.
"""

get: Optional[Callable[..., Any]]

decorators: List[Callable[[Callable[..., Any]], Callable[..., Any]]] = []

def __init_subclass__(
Expand Down Expand Up @@ -146,9 +144,11 @@ def __init_subclass__(

def dispatch_request(self, request: Request, *args, **kwargs):
"""Dispatch request to appropriate handler method."""
handler = getattr(self, request.method.lower(), None)
if not handler and request.method == "HEAD":
handler = self.get
method = request.method.lower()
handler = getattr(self, method)
Comment thread
ahopkins marked this conversation as resolved.
Outdated

if not handler and method == "head":
handler = getattr(self, "get")
if not handler:
# The router will never allow us to get here, but this is
# included as a fallback and for completeness.
Expand Down