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/authorization.hpp b/include/authorization.hpp
index 9074377..8237bc4 100644
--- a/include/authorization.hpp
+++ b/include/authorization.hpp
@@ -140,7 +140,7 @@
     }
 #ifndef BMCWEB_INSECURE_DISABLE_CSRF_PREVENTION
     // RFC7231 defines methods that need csrf protection
-    if (req.method() != "GET"_method)
+    if (req.method() != boost::beast::http::verb::get)
     {
         std::string_view csrf = req.getHeaderValue("X-XSRF-TOKEN");
         // Make sure both tokens are filled
@@ -167,7 +167,7 @@
 static bool isOnWhitelist(const crow::Request& req)
 {
     // it's allowed to GET root node without authentication
-    if ("GET"_method == req.method())
+    if (boost::beast::http::verb::get == req.method())
     {
         if (req.url == "/redfish/v1" || req.url == "/redfish/v1/" ||
             req.url == "/redfish" || req.url == "/redfish/" ||
@@ -184,7 +184,7 @@
 
     // it's allowed to POST on session collection & login without
     // authentication
-    if ("POST"_method == req.method())
+    if (boost::beast::http::verb::post == req.method())
     {
         if ((req.url == "/redfish/v1/SessionService/Sessions") ||
             (req.url == "/redfish/v1/SessionService/Sessions/") ||
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index a7ac761..525c27d 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -253,19 +253,19 @@
 inline void handleFileUrl(const crow::Request& req, crow::Response& res,
                           const std::string& fileID)
 {
-    if (req.method() == "PUT"_method)
+    if (req.method() == boost::beast::http::verb::put)
     {
         handleFilePut(req, res, fileID);
         res.end();
         return;
     }
-    if (req.method() == "GET"_method)
+    if (req.method() == boost::beast::http::verb::get)
     {
         handleFileGet(res, fileID);
         res.end();
         return;
     }
-    if (req.method() == "DELETE"_method)
+    if (req.method() == boost::beast::http::verb::delete_)
     {
         handleFileDelete(res, fileID);
         res.end();
@@ -532,7 +532,7 @@
     // allowed only for admin
     BMCWEB_ROUTE(app, "/ibm/v1/")
         .requires({"ConfigureComponents", "ConfigureManager"})
-        .methods("GET"_method)(
+        .methods(boost::beast::http::verb::get)(
             [](const crow::Request& req, crow::Response& res) {
                 res.jsonValue["@odata.type"] =
                     "#ibmServiceRoot.v1_0_0.ibmServiceRoot";
@@ -548,7 +548,7 @@
 
     BMCWEB_ROUTE(app, "/ibm/v1/Host/ConfigFiles")
         .requires({"ConfigureComponents", "ConfigureManager"})
-        .methods("GET"_method)(
+        .methods(boost::beast::http::verb::get)(
             [](const crow::Request& req, crow::Response& res) {
                 handleConfigFileList(res);
             });
@@ -556,27 +556,28 @@
     BMCWEB_ROUTE(app,
                  "/ibm/v1/Host/ConfigFiles/Actions/FileCollection.DeleteAll")
         .requires({"ConfigureComponents", "ConfigureManager"})
-        .methods("POST"_method)(
+        .methods(boost::beast::http::verb::post)(
             [](const crow::Request& req, crow::Response& res) {
                 deleteConfigFiles(res);
             });
 
     BMCWEB_ROUTE(app, "/ibm/v1/Host/ConfigFiles/<path>")
         .requires({"ConfigureComponents", "ConfigureManager"})
-        .methods("PUT"_method, "GET"_method, "DELETE"_method)(
+        .methods(boost::beast::http::verb::put, boost::beast::http::verb::get,
+                 boost::beast::http::verb::delete_)(
             [](const crow::Request& req, crow::Response& res,
                const std::string& path) { handleFileUrl(req, res, path); });
 
     BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService")
         .requires({"ConfigureComponents", "ConfigureManager"})
-        .methods("GET"_method)(
+        .methods(boost::beast::http::verb::get)(
             [](const crow::Request& req, crow::Response& res) {
                 getLockServiceData(res);
             });
 
     BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService/Actions/LockService.AcquireLock")
         .requires({"ConfigureComponents", "ConfigureManager"})
-        .methods("POST"_method)(
+        .methods(boost::beast::http::verb::post)(
             [](const crow::Request& req, crow::Response& res) {
                 std::vector<nlohmann::json> body;
                 if (!redfish::json_util::readJson(req, res, "Request", body))
@@ -590,8 +591,8 @@
             });
     BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock")
         .requires({"ConfigureComponents", "ConfigureManager"})
-        .methods(
-            "POST"_method)([](const crow::Request& req, crow::Response& res) {
+        .methods(boost::beast::http::verb::post)([](const crow::Request& req,
+                                                    crow::Response& res) {
             std::string type;
             std::vector<uint32_t> listTransactionIds;
 
@@ -620,7 +621,7 @@
         });
     BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService/Actions/LockService.GetLockList")
         .requires({"ConfigureComponents", "ConfigureManager"})
-        .methods("POST"_method)(
+        .methods(boost::beast::http::verb::post)(
             [](const crow::Request& req, crow::Response& res) {
                 ListOfSessionIds listSessionIds;
 
diff --git a/include/image_upload.hpp b/include/image_upload.hpp
index 64adccd..c1ec682 100644
--- a/include/image_upload.hpp
+++ b/include/image_upload.hpp
@@ -114,15 +114,15 @@
 {
     BMCWEB_ROUTE(app, "/upload/image/<str>")
         .requires({"ConfigureComponents", "ConfigureManager"})
-        .methods("POST"_method,
-                 "PUT"_method)([](const crow::Request& req, crow::Response& res,
-                                  const std::string& filename) {
-            uploadImageHandler(req, res, filename);
-        });
+        .methods(boost::beast::http::verb::post, boost::beast::http::verb::put)(
+            [](const crow::Request& req, crow::Response& res,
+               const std::string& filename) {
+                uploadImageHandler(req, res, filename);
+            });
 
     BMCWEB_ROUTE(app, "/upload/image")
         .requires({"ConfigureComponents", "ConfigureManager"})
-        .methods("POST"_method, "PUT"_method)(
+        .methods(boost::beast::http::verb::post, boost::beast::http::verb::put)(
             [](const crow::Request& req, crow::Response& res) {
                 uploadImageHandler(req, res, "");
             });
diff --git a/include/login_routes.hpp b/include/login_routes.hpp
index 346ab89..91acda7 100644
--- a/include/login_routes.hpp
+++ b/include/login_routes.hpp
@@ -28,8 +28,8 @@
         "auth routes");
 
     BMCWEB_ROUTE(app, "/login")
-        .methods(
-            "POST"_method)([](const crow::Request& req, crow::Response& res) {
+        .methods(boost::beast::http::verb::post)([](const crow::Request& req,
+                                                    crow::Response& res) {
             std::string_view contentType = req.getHeaderValue("content-type");
             std::string_view username;
             std::string_view password;
@@ -196,7 +196,7 @@
         });
 
     BMCWEB_ROUTE(app, "/logout")
-        .methods("POST"_method)(
+        .methods(boost::beast::http::verb::post)(
             [](const crow::Request& req, crow::Response& res) {
                 auto& session = req.session;
                 if (session != nullptr)
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();
diff --git a/include/redfish_v1.hpp b/include/redfish_v1.hpp
index 3a4b9f5..dfdb900 100644
--- a/include/redfish_v1.hpp
+++ b/include/redfish_v1.hpp
@@ -17,7 +17,7 @@
 void requestRoutes(Crow<Middlewares...>& app)
 {
     BMCWEB_ROUTE(app, "/redfish/")
-        .methods("GET"_method)(
+        .methods(boost::beast::http::verb::get)(
             [](const crow::Request& req, crow::Response& res) {
                 res.jsonValue = {{"v1", "/redfish/v1/"}};
                 res.end();
diff --git a/include/security_headers_middleware.hpp b/include/security_headers_middleware.hpp
index ec72cbb..d3c3335 100644
--- a/include/security_headers_middleware.hpp
+++ b/include/security_headers_middleware.hpp
@@ -13,7 +13,7 @@
     void beforeHandle(crow::Request& req, Response& res, Context& ctx)
     {
 #ifdef BMCWEB_INSECURE_DISABLE_XSS_PREVENTION
-        if ("OPTIONS"_method == req.method())
+        if (boost::beast::http::verb::options == req.method())
         {
             res.end();
         }