def _middleware_call(
            self,
            middlewares: Iterator[MIDDLEWARE_TYPE],
            ctx: Context,
            next_call: NEXT_CALL_TYPE,
    ) -> TypeGenerator[Any, None, None]:
        """
        从迭代器中取出一个中间件，执行
        """
        middleware = None
        try:
            middleware = next(middlewares)
        except StopIteration:
            return
        # next_call = self._next_middleware(middlewares, ctx)
        if asyncio.iscoroutinefunction(middleware):
            temp = cast(Any, middleware(ctx, next_call))
            body = yield from temp
        else:
            body = middleware(ctx, next_call)
        if body is not None:
            if isinstance(body, Generator):
                gen_obj = body
                body = None
                # 处理同步方法使用 yield 来调用异步
                while True:
                    try:
                        gen = next(gen_obj)
                        temp = yield from handle_async_gen(gen, gen_obj)
                    except StopIteration:
                        break
                    if temp is not None:
                        body = temp
            # elif asyncio.iscoroutine(body):
            #     # 处理中间件返回了一个 coroutine 对象需要 await
            #     try:
            #         body = yield from body
            #     except Exception:
            #         pass
            if isinstance(body, tuple):
                flag = True
                for item in body:
                    if flag:
                        ctx.response.body = item
                        flag = False
                    elif isinstance(item, int):
                        ctx.response.status = item
                    elif isinstance(item, dict):
                        ctx.response.headers.update(item)
            # 中间件返回的结果如果不为空设置到 body
            elif body is not None:
                ctx.response.body = body