MCPcopy
hub / github.com/aio-libs/aiohttp / add_route

Method add_route

aiohttp/web_urldispatcher.py:240–252  ·  aiohttp/web_urldispatcher.py::Resource.add_route
(self, method, handler, *,
                  expect_handler=None)

Source from the content-addressed store, hash-verified

238 self._routes = []
239
240 def add_route(self, method, handler, *,
241 expect_handler=None):
242
243 for route in self._routes:
244 if route.method == method or route.method == hdrs.METH_ANY:
245 raise RuntimeError(class="st">"Added route will never be executed, "
246 class="st">"method {route.method} is "
247 class="st">"already registered".format(route=route))
248
249 route = ResourceRoute(method, handler, self,
250 expect_handler=expect_handler)
251 self.register_route(route)
252 return route
253
254 def register_route(self, route):
255 assert isinstance(route, ResourceRoute), \

Callers 15

initFunction · 0.45
add_routeMethod · 0.45
create_serverMethod · 0.45
create_unix_serverMethod · 0.45
test_add_route_rootMethod · 0.45
test_add_route_simpleMethod · 0.45
test_add_with_nameMethod · 0.45
test_add_invalid_pathMethod · 0.45
test_add_url_invalid1Method · 0.45
test_add_url_invalid2Method · 0.45

Calls 2

register_routeMethod · 0.95
ResourceRouteClass · 0.85

Tested by 15

create_serverMethod · 0.36
create_unix_serverMethod · 0.36
test_add_route_rootMethod · 0.36
test_add_route_simpleMethod · 0.36
test_add_with_nameMethod · 0.36
test_add_invalid_pathMethod · 0.36
test_add_url_invalid1Method · 0.36
test_add_url_invalid2Method · 0.36
test_add_url_invalid3Method · 0.36
test_add_url_invalid4Method · 0.36