forked from orbit-oss/flask
Simplified HEAD handling for method views
This commit is contained in:
parent
7d7d810aea
commit
32c7e43dda
3 changed files with 42 additions and 1 deletions
|
|
@ -143,5 +143,9 @@ class MethodView(View):
|
|||
|
||||
def dispatch_request(self, *args, **kwargs):
|
||||
meth = getattr(self, request.method.lower(), None)
|
||||
assert meth is not None, 'Not implemented method'
|
||||
# if the request method is HEAD and we don't have a handler for it
|
||||
# retry with GET
|
||||
if meth is None and request.method == 'HEAD':
|
||||
meth = getattr(self, 'get', None)
|
||||
assert meth is not None, 'Not implemented method %r' % request.method
|
||||
return meth(*args, **kwargs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue