Fix regression in @odata failure paths
5b224921d765a93c5f93a6012109a9a748ef7cd4
and
a1e0871d2425b3f42d0e5893d548593e5ed576b
Added code to handle links looked correct in review, but the
deduplication of the HEAD methods now causes the return code of
setUpRedfishRoute to be ignored. This means that query parameter
or other header failures don't stop the request, which is bad.
Tested:
GET /redfish/v1 (ie ServiceRoot) returns the correct header.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iec01051221550747a7b99da5eb7713e18394d530
diff --git a/redfish-core/lib/redfish_sessions.hpp b/redfish-core/lib/redfish_sessions.hpp
index 4c98974..341e6d0 100644
--- a/redfish-core/lib/redfish_sessions.hpp
+++ b/redfish-core/lib/redfish_sessions.hpp
@@ -158,7 +158,14 @@
crow::App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- handleSessionCollectionHead(app, req, asyncResp);
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ asyncResp->res.addHeader(
+ boost::beast::http::field::link,
+ "</redfish/v1/JsonSchemas/SessionCollection.json>; rel=describedby");
+
asyncResp->res.jsonValue["Members"] = getSessionCollectionMembers();
asyncResp->res.jsonValue["Members@odata.count"] =
asyncResp->res.jsonValue["Members"].size();
diff --git a/redfish-core/lib/service_root.hpp b/redfish-core/lib/service_root.hpp
index d94f446..6ae16c3 100644
--- a/redfish-core/lib/service_root.hpp
+++ b/redfish-core/lib/service_root.hpp
@@ -47,6 +47,10 @@
inline void handleServiceRootGetImpl(
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
+ asyncResp->res.addHeader(
+ boost::beast::http::field::link,
+ "</redfish/v1/JsonSchemas/ServiceRoot/ServiceRoot.json>; rel=describedby");
+
std::string uuid = persistent_data::getConfig().systemUuid;
asyncResp->res.jsonValue["@odata.type"] =
"#ServiceRoot.v1_15_0.ServiceRoot";
@@ -111,7 +115,11 @@
handleServiceRootGet(App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- handleServiceRootHead(app, req, asyncResp);
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+
handleServiceRootGetImpl(asyncResp);
}