Avoid http request copy in OEM handler
Initial copy was done to avoid request object going out of scope before
OEM handler are invoked.
The MR avoids the whole copy of the request object and create a sub
route object which contains elements required for OEM route handling.
Tested
- Service Validator Passes
- OpenBMC OEM properties and rendered well.
Change-Id: I3ef80a130afe6ab764a13704a8b672f5b0635126
Signed-off-by: Rohit PAI <ropai@nvidia.com>
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
index f92e4ef..f6628eb 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
@@ -6,6 +6,7 @@
#include "async_resp.hpp"
#include "http_request.hpp"
#include "redfish_oem_routing.hpp"
+#include "sub_request.hpp"
#include "verb.hpp"
#include <memory>
@@ -50,7 +51,8 @@
const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) const
{
- oemRouter.handle(req, asyncResp);
+ auto subReq = std::make_shared<SubRequest>(req);
+ oemRouter.handle(subReq, asyncResp);
}
OemRouter oemRouter;