def METHOD_NAME(self) -> None:
    for middleware in self._custom_middleware:
        try:
            self.middleware_onion.remove(middleware)
        except ValueError:
            pass
        middleware.uninstall()
    self._custom_middleware.clear()