diff --git a/sanic/blueprints.py b/sanic/blueprints.py index 583aa244..101c698f 100644 --- a/sanic/blueprints.py +++ b/sanic/blueprints.py @@ -87,7 +87,7 @@ class Blueprint: for deferred in self.deferred_functions: deferred(state) - def route(self, uri, methods=None, host=None): + def route(self, uri, methods=frozenset({'GET'}), host=None): """ """ def decorator(handler): diff --git a/sanic/sanic.py b/sanic/sanic.py index 94fcd983..5182b9fb 100644 --- a/sanic/sanic.py +++ b/sanic/sanic.py @@ -46,7 +46,7 @@ class Sanic: # -------------------------------------------------------------------- # # 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 :param uri: path of the URL diff --git a/tests/test_routes.py b/tests/test_routes.py index 9c671829..be1fb29e 100644 --- a/tests/test_routes.py +++ b/tests/test_routes.py @@ -497,7 +497,7 @@ def test_overload_routes(): def test_unmergeable_overload_routes(): app = Sanic('test_dynamic_route') - @app.route('/overload_whole') + @app.route('/overload_whole', methods=None) async def handler1(request): return text('OK1')