Handle trailing slashes in MultipartUpdate URL.
Modified the BMCWeb server to strip trailing slashes from the URL when processing requests, allowing `/tlbmc/redfish/v1/UpdateService/MultipartUpdate/` to be correctly routed. A new test case was added to `update_service_test.cc` to validate this behavior.
#bmc-bloom
Tested: unit test
PiperOrigin-RevId: 805119330
Change-Id: Idf92432f8d6af3da97a48369fedf99e0efeccff7
diff --git a/g3/server.cc b/g3/server.cc
index ddcef04..e23a660 100644
--- a/g3/server.cc
+++ b/g3/server.cc
@@ -868,6 +868,9 @@
stripped_url =
stripped_url.substr(milotic_tlbmc::kTlbmcPrefix.size() - 1);
}
+ if (!stripped_url.empty() && stripped_url.back() == '/') {
+ stripped_url.pop_back();
+ }
if (stripped_url != "/redfish/v1/UpdateService/MultipartUpdate" ||
method != boost::beast::http::verb::post) {
boost_request.body() = request->octet_stream();