Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _build_middlewares_chain(self):
async def root_handler(request):
return await self._send_core(request)
self._handler = get_middlewares_chain(self._middlewares, root_handler)
def _apply_middlewares_in_routes(self):
configured_handlers = set()
for route in self.router:
if route.handler in configured_handlers:
continue
route.handler = get_middlewares_chain(self.middlewares, route.handler)
configured_handlers.add(route.handler)
configured_handlers.clear()