Using AsyncResp everywhere
Get the core using AsyncResp everywhere, and not have each individual handler
creating its own object.We can call app.handle() without fear of the response
getting ended after the first tree is done populating.
Don't use res.end() anymore.
Tested:
1. Validator passed.
Signed-off-by: zhanghaicheng <zhanghch05@inspur.com>
Change-Id: I867367ce4a0caf8c4b3f4e07e06c11feed0782e8
diff --git a/http/app.hpp b/http/app.hpp
index d5e2d2b..4735197 100644
--- a/http/app.hpp
+++ b/http/app.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include "async_resp.hpp"
#include "http_request.hpp"
#include "http_server.hpp"
#include "logging.hpp"
@@ -49,9 +50,10 @@
router.handleUpgrade(req, res, std::move(adaptor));
}
- void handle(Request& req, Response& res)
+ void handle(Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- router.handle(req, res);
+ router.handle(req, asyncResp);
}
DynamicRule& routeDynamic(std::string&& rule)