summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-05-12 00:40:49 +0300
committerEd Tanous <edtanous@google.com>2022-05-13 03:55:50 +0300
commitd3355c5cdd4ce4e39df7d2f424eb4a60fee16731 (patch)
tree09b43a6320660d1338ab7b2d6b2f95dc91edbcba
parent1e925c84be9c1786843e21077ac94a125ac1aa86 (diff)
downloadbmcweb-d3355c5cdd4ce4e39df7d2f424eb4a60fee16731.tar.xz
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
-rw-r--r--redfish-core/lib/redfish_v1.hpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/redfish-core/lib/redfish_v1.hpp b/redfish-core/lib/redfish_v1.hpp
index b2f308b8e8..52d8c7620f 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