Handle redfish 404 with a good message
Not found 404 on redfish entries has always returned the generic, bmcweb
core driven 404, that didn't include a message. This works most of the
time, because most things have BMCWEB_ROUTE entries, but there's a whole
class of routes that bmcweb doesn't implement, that should also return
404, with a resourceNotFound message.
This commit registers a generic /redfish/<path> route that forces things
to return 404.
One compromise made is that for a given route, if we don't know what
"type" the user was expecting back, there's no way to fill in the first
argument with the Redfish type, so this patchset opts for filling it in
with empty string "". This is arguably incorrect, but still better than
what we had previously, so it seems like an acceptable compromise.
Tested:
curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/Systems
returns the SystemCollection resource as expected
curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/foo
Returns a ResourceNotFound message, as Redfish expects.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ibef1ded004a950124104cf392b6bf9b679b3c85a
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
index eae83e8..b7dd3b3 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
@@ -216,6 +216,7 @@
requestRoutesTriggerCollection(app);
requestRoutesTrigger(app);
+ // Note, this must be the last route registered
requestRoutesRedfish(app);
}
};