Merge pull request #316 from youknowone/route-get

For function decorators, ['GET'] is the default methods
This commit is contained in:
Eli Uriegas 2017-01-19 21:31:06 -06:00 committed by GitHub
commit c6049be688
3 changed files with 3 additions and 3 deletions

View File

@ -90,7 +90,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):
""" """
Creates a blueprint route from a decorated function. Creates a blueprint route from a decorated function.
:param uri: Endpoint at which the route will be accessible. :param uri: Endpoint at which the route will be accessible.

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

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')