raise error when method/route overlap

This commit is contained in:
Raphael Deem 2017-08-19 23:20:27 -07:00
parent 85fb7c6201
commit 4e6e364467

View File

@ -234,6 +234,12 @@ class Router:
if route and merge_routes:
route = merge_route(route, methods, handler)
elif route and route.methods.intersection(methods):
# already existing method is not overloadable.
duplicated = methods.intersection(route.methods)
raise RouteExists(
"Route already registered: {} [{}]".format(
uri, ','.join(list(duplicated))))
else:
# prefix the handler name with the blueprint name
# if available