Move /redfish to free methods
Similar to the refactors done elsewhere, move the /redfish route to a
free method.
Tested:
curl /redfish/v1 returns the same payload as previously.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Icd7668e8e3779926508aa901959b2ca6d079c8f0
diff --git a/redfish-core/lib/redfish_v1.hpp b/redfish-core/lib/redfish_v1.hpp
index b2f308b..52d8c76 100644
--- a/redfish-core/lib/redfish_v1.hpp
+++ b/redfish-core/lib/redfish_v1.hpp
@@ -9,17 +9,20 @@
namespace redfish
{
+inline void redfishGet(App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
+ {
+ return;
+ }
+ asyncResp->res.jsonValue["v1"] = "/redfish/v1/";
+}
+
inline void requestRoutes(App& app)
{
BMCWEB_ROUTE(app, "/redfish/")
.methods(boost::beast::http::verb::get)(
- [&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
- {
- return;
- }
- asyncResp->res.jsonValue["v1"] = "/redfish/v1/";
- });
+ std::bind_front(redfishGet, std::ref(app)));
}
} // namespace redfish