summaryrefslogtreecommitdiff
path: root/redfish-core/lib/redfish_v1.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-07-27 02:47:23 +0300
committerEd Tanous <ed@tanous.net>2022-09-01 02:01:04 +0300
commit44e4518b700bd97cdca09d05e3c24712a4799788 (patch)
tree9959e9d739a2bb6ce3cddddf83d22f27af1affc2 /redfish-core/lib/redfish_v1.hpp
parent1e75e1dde032e327f16cf7270b0de621f0c6ccc6 (diff)
downloadbmcweb-44e4518b700bd97cdca09d05e3c24712a4799788.tar.xz
Allow custom 404 handlers
Different HTTP protocols have different http responses for 404. This commit adds support for registering a route designed to host a handler meant for when a response would otherwise return. This allows registering a custom 404 handler for Redfish, for which all routes will now return a Redfish response. This was in response to the 404 handler not working in all cases (in the case of POST/PATCH/DELETE). Allowing an explicit registration helps to give the intended behavior in all cases. Tested: GET /redfish/v1/foo returns 404 Not found PATCH /redfish/v1/foo returns 404 Not found GET /redfish/v1 returns 200 OK, and content PATCH /redfish/v1 returns 405 Method Not Allowed With Redfish Aggregation: GET /redfish/v1/foo gets forwarded to satellite BMC PATCH /redfish/v1/foo does not get forwarded and returns 404 PATCH /redfish/v1/foo/5B247A_bar gets forwarded Unit tests pass Redfish-service-validator passes Redfish-Protocol-Validator fails 7 tests (same as before) Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I731a5b4e736a2480700d8f3e81f9c9c6cbe6efca Signed-off-by: Carson Labrado <clabrado@google.com>
Diffstat (limited to 'redfish-core/lib/redfish_v1.hpp')
-rw-r--r--redfish-core/lib/redfish_v1.hpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/redfish-core/lib/redfish_v1.hpp b/redfish-core/lib/redfish_v1.hpp
index a9a786d7d8..6aa3ee6d5a 100644
--- a/redfish-core/lib/redfish_v1.hpp
+++ b/redfish-core/lib/redfish_v1.hpp
@@ -137,7 +137,7 @@ inline void requestRoutesRedfish(App& app)
// Note, this route must always be registered last
BMCWEB_ROUTE(app, "/redfish/<path>")
- (std::bind_front(redfish404, std::ref(app)));
+ .notFound()(std::bind_front(redfish404, std::ref(app)));
}
} // namespace redfish