We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我是想在自定义的过滤器中,实现doFilter, 但是我不想用异步回调方式,我想使用协程方式实现。 我看基类 HttpFilter 中有个 virtual Task doFilter(const HttpRequestPtr &req) = 0;
具体有实现这个协程方式doFilter的示例吗?
The text was updated successfully, but these errors were encountered:
drogon/lib/tests/integration_test/server/CoroFilter.cpp
Lines 7 to 12 in a3b4779
Sorry, something went wrong.
drogon/lib/tests/integration_test/server/CoroFilter.cpp Lines 7 to 12 in a3b4779 Task CoroFilter::doFilter(const HttpRequestPtr& req) { int secs = std::stoi(req->getParameter("secs")); co_await sleepCoro(trantor::EventLoop::getEventLoopOfCurrentThread(), secs); co_return {}; } 大概是这个样子,返回空就通过,返回一个构造好的HttpResponsePtr对象就拦截了。
Task CoroFilter::doFilter(const HttpRequestPtr& req) { int secs = std::stoi(req->getParameter("secs")); co_await sleepCoro(trantor::EventLoop::getEventLoopOfCurrentThread(), secs); co_return {}; }
大概是这个样子,返回空就通过,返回一个构造好的HttpResponsePtr对象就拦截了。
感谢,我去试一下!
No branches or pull requests
我是想在自定义的过滤器中,实现doFilter, 但是我不想用异步回调方式,我想使用协程方式实现。
我看基类 HttpFilter 中有个 virtual Task doFilter(const HttpRequestPtr &req) = 0;
具体有实现这个协程方式doFilter的示例吗?
The text was updated successfully, but these errors were encountered: