Remove number support from the router
The router historically came from crow. Crow supported wildcards of
<int>, <float>, and <double>. bmcweb doesn't use them, nor should it in
basically any case, as we now have explicit 404 handling.
This commit removes them. This amounts to about -450 lines of code, but
it's some of the scarier code we have, some of it existing in the
namespace "black_magic". Reducing the brain debt for people working in
this subsystem seems worthwhile. There is no case in the future where
we would use integer based url parameters.
Tested: Redfish service validator passes. Should be good enough
coverage for a code removal.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I34add8df7d3486952474ca7ec3dc6be990c50ed0
diff --git a/test/http/crow_getroutes_test.cpp b/test/http/crow_getroutes_test.cpp
index 23a511e..e5c9d6e 100644
--- a/test/http/crow_getroutes_test.cpp
+++ b/test/http/crow_getroutes_test.cpp
@@ -20,6 +20,7 @@
namespace
{
+using ::bmcweb::AsyncResp;
using ::testing::Eq;
using ::testing::IsEmpty;
using ::testing::Pointee;
@@ -38,7 +39,9 @@
{
App app;
- BMCWEB_ROUTE(app, "/")([]() { return boost::beast::http::status::ok; });
+ BMCWEB_ROUTE(app, "/")
+ ([](const crow::Request& /*req*/,
+ const std::shared_ptr<AsyncResp>& /*asyncResp*/) {});
// TODO: "/" doesn't get reported in |getRoutes| today. Uncomment this once
// it is fixed
@@ -50,12 +53,18 @@
TEST(GetRoutes, TestlotsOfRoutes)
{
App app;
- BMCWEB_ROUTE(app, "/")([]() { return boost::beast::http::status::ok; });
- BMCWEB_ROUTE(app, "/foo")([]() { return boost::beast::http::status::ok; });
- BMCWEB_ROUTE(app, "/bar")([]() { return boost::beast::http::status::ok; });
- BMCWEB_ROUTE(app, "/baz")([]() { return boost::beast::http::status::ok; });
- BMCWEB_ROUTE(app, "/boo")([]() { return boost::beast::http::status::ok; });
- BMCWEB_ROUTE(app, "/moo")([]() { return boost::beast::http::status::ok; });
+ BMCWEB_ROUTE(app, "/")
+ ([](const Request& /*req*/, const std::shared_ptr<AsyncResp>& /*res*/) {});
+ BMCWEB_ROUTE(app, "/foo")
+ ([](const Request& /*req*/, const std::shared_ptr<AsyncResp>& /*res*/) {});
+ BMCWEB_ROUTE(app, "/bar")
+ ([](const Request& /*req*/, const std::shared_ptr<AsyncResp>& /*res*/) {});
+ BMCWEB_ROUTE(app, "/baz")
+ ([](const Request& /*req*/, const std::shared_ptr<AsyncResp>& /*res*/) {});
+ BMCWEB_ROUTE(app, "/boo")
+ ([](const Request& /*req*/, const std::shared_ptr<AsyncResp>& /*res*/) {});
+ BMCWEB_ROUTE(app, "/moo")
+ ([](const Request& /*req*/, const std::shared_ptr<AsyncResp>& /*res*/) {});
app.validate();
diff --git a/test/http/utility_test.cpp b/test/http/utility_test.cpp
index 957c13d..6726455 100644
--- a/test/http/utility_test.cpp
+++ b/test/http/utility_test.cpp
@@ -220,17 +220,9 @@
TEST(Router, ParameterTagging)
{
- EXPECT_EQ(6 * 6 + 6 * 3 + 2, getParameterTag("<uint><double><int>"));
- EXPECT_EQ(1, getParameterTag("<int>"));
- EXPECT_EQ(2, getParameterTag("<uint>"));
- EXPECT_EQ(3, getParameterTag("<float>"));
- EXPECT_EQ(3, getParameterTag("<double>"));
- EXPECT_EQ(4, getParameterTag("<str>"));
- EXPECT_EQ(4, getParameterTag("<string>"));
- EXPECT_EQ(5, getParameterTag("<path>"));
- EXPECT_EQ(6 * 6 + 6 + 1, getParameterTag("<int><int><int>"));
- EXPECT_EQ(6 * 6 + 6 + 2, getParameterTag("<uint><int><int>"));
- EXPECT_EQ(6 * 6 + 6 * 3 + 2, getParameterTag("<uint><double><int>"));
+ EXPECT_EQ(1, getParameterTag("<str>"));
+ EXPECT_EQ(1, getParameterTag("<string>"));
+ EXPECT_EQ(2, getParameterTag("<path>"));
}
TEST(URL, JsonEncoding)