Merge pull request #316 from youknowone/route-get
For function decorators, ['GET'] is the default methods
This commit is contained in:
commit
c6049be688
|
@ -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.
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user