Deprecate the "" operator, and isEqP
While a cool example of how to do string matching in constexpr space,
the set of verbs available to HTTP has been fixed for a very long time.
This was ported over to beast a while back, but we kept the API for....
mediocre reasons of backward compatibility. Remove that, and delete the
now unused code.
Tested: Built and loaded on a Witherspoon. Validator passes.
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Change-Id: Iaf048e196f9b6e71983189877203bf80390df286
Signed-off-by: James Feist <james.feist@linux.intel.com>
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index ea7dc95..c41a568 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -2013,7 +2013,7 @@
objectPath = objectPath.substr(0, attrPosition);
}
- if (req.method() == "POST"_method)
+ if (req.method() == boost::beast::http::verb::post)
{
constexpr const char* actionSeperator = "/action/";
size_t actionPosition = objectPath.find(actionSeperator);
@@ -2027,7 +2027,7 @@
return;
}
}
- else if (req.method() == "GET"_method)
+ else if (req.method() == boost::beast::http::verb::get)
{
if (boost::ends_with(objectPath, "/enumerate"))
{
@@ -2056,12 +2056,12 @@
}
return;
}
- else if (req.method() == "PUT"_method)
+ else if (req.method() == boost::beast::http::verb::put)
{
handlePut(req, res, objectPath, destProperty);
return;
}
- else if (req.method() == "DELETE"_method)
+ else if (req.method() == boost::beast::http::verb::delete_)
{
handleDelete(req, res, objectPath);
return;
@@ -2077,7 +2077,7 @@
{
BMCWEB_ROUTE(app, "/bus/")
.requires({"Login"})
- .methods("GET"_method)(
+ .methods(boost::beast::http::verb::get)(
[](const crow::Request& req, crow::Response& res) {
res.jsonValue = {{"buses", {{{"name", "system"}}}},
{"status", "ok"}};
@@ -2086,7 +2086,7 @@
BMCWEB_ROUTE(app, "/bus/system/")
.requires({"Login"})
- .methods("GET"_method)(
+ .methods(boost::beast::http::verb::get)(
[](const crow::Request& req, crow::Response& res) {
auto myCallback = [&res](const boost::system::error_code ec,
std::vector<std::string>& names) {
@@ -2115,22 +2115,24 @@
BMCWEB_ROUTE(app, "/list/")
.requires({"Login"})
- .methods("GET"_method)(
+ .methods(boost::beast::http::verb::get)(
[](const crow::Request& req, crow::Response& res) {
handleList(res, "/");
});
BMCWEB_ROUTE(app, "/xyz/<path>")
.requires({"Login"})
- .methods("GET"_method)([](const crow::Request& req, crow::Response& res,
- const std::string& path) {
+ .methods(boost::beast::http::verb::get)([](const crow::Request& req,
+ crow::Response& res,
+ const std::string& path) {
std::string objectPath = "/xyz/" + path;
handleDBusUrl(req, res, objectPath);
});
BMCWEB_ROUTE(app, "/xyz/<path>")
.requires({"ConfigureComponents", "ConfigureManager"})
- .methods("PUT"_method, "POST"_method, "DELETE"_method)(
+ .methods(boost::beast::http::verb::put, boost::beast::http::verb::post,
+ boost::beast::http::verb::delete_)(
[](const crow::Request& req, crow::Response& res,
const std::string& path) {
std::string objectPath = "/xyz/" + path;
@@ -2139,15 +2141,17 @@
BMCWEB_ROUTE(app, "/org/<path>")
.requires({"Login"})
- .methods("GET"_method)([](const crow::Request& req, crow::Response& res,
- const std::string& path) {
+ .methods(boost::beast::http::verb::get)([](const crow::Request& req,
+ crow::Response& res,
+ const std::string& path) {
std::string objectPath = "/org/" + path;
handleDBusUrl(req, res, objectPath);
});
BMCWEB_ROUTE(app, "/org/<path>")
.requires({"ConfigureComponents", "ConfigureManager"})
- .methods("PUT"_method, "POST"_method, "DELETE"_method)(
+ .methods(boost::beast::http::verb::put, boost::beast::http::verb::post,
+ boost::beast::http::verb::delete_)(
[](const crow::Request& req, crow::Response& res,
const std::string& path) {
std::string objectPath = "/org/" + path;
@@ -2156,8 +2160,9 @@
BMCWEB_ROUTE(app, "/download/dump/<str>/")
.requires({"ConfigureManager"})
- .methods("GET"_method)([](const crow::Request& req, crow::Response& res,
- const std::string& dumpId) {
+ .methods(boost::beast::http::verb::get)([](const crow::Request& req,
+ crow::Response& res,
+ const std::string& dumpId) {
std::regex validFilename("^[\\w\\- ]+(\\.?[\\w\\- ]*)$");
if (!std::regex_match(dumpId, validFilename))
{
@@ -2223,19 +2228,23 @@
BMCWEB_ROUTE(app, "/bus/system/<str>/")
.requires({"Login"})
- .methods("GET"_method)([](const crow::Request& req, crow::Response& res,
- const std::string& Connection) {
- introspectObjects(Connection, "/",
- std::make_shared<bmcweb::AsyncResp>(res));
- });
+
+ .methods(boost::beast::http::verb::get)(
+ [](const crow::Request& req, crow::Response& res,
+ const std::string& Connection) {
+ introspectObjects(Connection, "/",
+ std::make_shared<bmcweb::AsyncResp>(res));
+ });
BMCWEB_ROUTE(app, "/bus/system/<str>/<path>")
.requires({"ConfigureComponents", "ConfigureManager"})
- .methods("GET"_method,
- "POST"_method)([](const crow::Request& req,
- crow::Response& res,
- const std::string& processName,
- const std::string& requestedPath) {
+ .methods(
+ boost::beast::http::verb::get,
+ boost::beast::http::verb::post)([](const crow::Request& req,
+ crow::Response& res,
+ const std::string& processName,
+ const std::string&
+ requestedPath) {
std::vector<std::string> strs;
boost::split(strs, requestedPath, boost::is_any_of("/"));
std::string objectPath;
@@ -2532,7 +2541,7 @@
}
else
{
- if (req.method() != "POST"_method)
+ if (req.method() != boost::beast::http::verb::post)
{
res.result(boost::beast::http::status::not_found);
res.end();