summaryrefslogtreecommitdiff
path: root/redfish-core/include/node.hpp
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2018-03-28 03:41:04 +0300
committerEd Tanous <ed.tanous@intel.com>2018-06-29 21:18:14 +0300
commite0d918bc397350aa21af3dab9faa6e21748f6373 (patch)
treebdc13d1e9937c0f153e89f3ab1be050d4bf52ee7 /redfish-core/include/node.hpp
parent77dd8813e9a1f2baec63d959de15af39a8cd12d0 (diff)
downloadbmcweb-e0d918bc397350aa21af3dab9faa6e21748f6373.tar.xz
Boost beast
This commit is the beginings of attempting to transition away from crow, and toward boost::beast. Unit tests are passing, and implementation appears to be slightly faster than crow. Change-Id: Ic8d946dc7a04f514c67b1098f181eee1ced69171
Diffstat (limited to 'redfish-core/include/node.hpp')
-rw-r--r--redfish-core/include/node.hpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/redfish-core/include/node.hpp b/redfish-core/include/node.hpp
index b41439aac1..3fb0ce7370 100644
--- a/redfish-core/include/node.hpp
+++ b/redfish-core/include/node.hpp
@@ -102,19 +102,19 @@ class Node {
virtual void doPatch(crow::response& res, const crow::request& req,
const std::vector<std::string>& params) {
- res.code = static_cast<int>(HttpRespCode::METHOD_NOT_ALLOWED);
+ res.result(boost::beast::http::status::method_not_allowed);
res.end();
}
virtual void doPost(crow::response& res, const crow::request& req,
const std::vector<std::string>& params) {
- res.code = static_cast<int>(HttpRespCode::METHOD_NOT_ALLOWED);
+ res.result(boost::beast::http::status::method_not_allowed);
res.end();
}
virtual void doDelete(crow::response& res, const crow::request& req,
const std::vector<std::string>& params) {
- res.code = static_cast<int>(HttpRespCode::METHOD_NOT_ALLOWED);
+ res.result(boost::beast::http::status::method_not_allowed);
res.end();
}
@@ -127,14 +127,14 @@ class Node {
auto ctx =
app.template get_context<crow::TokenAuthorization::Middleware>(req);
- if (!isMethodAllowedForUser(req.method, entityPrivileges,
+ if (!isMethodAllowedForUser(req.method(), entityPrivileges,
ctx.session->username)) {
- res.code = static_cast<int>(HttpRespCode::METHOD_NOT_ALLOWED);
+ res.result(boost::beast::http::status::method_not_allowed);
res.end();
return;
}
- switch (req.method) {
+ switch (req.method()) {
case "GET"_method:
doGet(res, req, params);
break;
@@ -152,7 +152,7 @@ class Node {
break;
default:
- res.code = static_cast<int>(HttpRespCode::NOT_FOUND);
+ res.result(boost::beast::http::status::not_found);
res.end();
}
return;