For function decorators, ['GET'] is the default methods

This commit is contained in:
Jeong YunWon 2017-01-19 23:56:51 +09:00
parent 1ad7b95437
commit 0a160c4a0b
3 changed files with 3 additions and 3 deletions

View File

@ -87,7 +87,7 @@ class Blueprint:
for deferred in self.deferred_functions: for deferred in self.deferred_functions:
deferred(state) deferred(state)
def route(self, uri, methods=None, host=None): def route(self, uri, methods=frozenset({'GET'}), host=None):
""" """
""" """
def decorator(handler): def decorator(handler):

View File

@ -46,7 +46,7 @@ class Sanic:
# -------------------------------------------------------------------- # # -------------------------------------------------------------------- #
# Decorator # Decorator
def route(self, uri, methods=None, host=None): def route(self, uri, methods=frozenset({'GET'}), host=None):
""" """
Decorates a function to be registered as a route Decorates a function to be registered as a route
:param uri: path of the URL :param uri: path of the URL

View File

@ -497,7 +497,7 @@ def test_overload_routes():
def test_unmergeable_overload_routes(): def test_unmergeable_overload_routes():
app = Sanic('test_dynamic_route') app = Sanic('test_dynamic_route')
@app.route('/overload_whole') @app.route('/overload_whole', methods=None)
async def handler1(request): async def handler1(request):
return text('OK1') return text('OK1')