When user specifies HTTP methods to function handlers, it automatically
will be overloaded unless they duplicate.
Example:
# This is a new route. It works as before.
@app.route('/overload', methods=['GET'])
async def handler1(request):
return text('OK1')
# This is the exiting route but a new method. They are merged and
# work as combined. The route will serve all of GET, POST and PUT.
@app.route('/overload', methods=['POST', 'PUT'])
async def handler2(request):
return text('OK2')
# This is the existing route and PUT method is the duplicated method.
# It raises RouteExists.
@app.route('/overload', methods=['PUT', 'DELETE'])
async def handler3(request):
return text('Duplicated')