summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2018-12-11 11:47:17 -0600
committerEd Tanous <ed.tanous@intel.com>2018-12-13 21:55:53 +0000
commitc4e8d21d6ea17f2b9ce75b709b632393f676675b (patch)
treee931c52403150b07049e5611e07cbe40f97687d8 /include
parent6db062420e61dbd86e7ff54d3f20cf5352952406 (diff)
downloadbmcweb-c4e8d21d6ea17f2b9ce75b709b632393f676675b.tar.gz
bmcweb-c4e8d21d6ea17f2b9ce75b709b632393f676675b.zip
REST: Add JSON error when no D-Bus handlers found
Add the full JSON error response for the case when the URL looks like it should correspond to a D-Bus operation, but doesn't. Change-Id: I63a2c05fd8ab3adcdd81d407f9359ebb0279cdc3 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/openbmc_dbus_rest.hpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index dfa618f..c8811a6 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -36,12 +36,14 @@ using GetSubTreeType = std::vector<
const std::string notFoundMsg = "404 Not Found";
const std::string badReqMsg = "400 Bad Request";
+const std::string methodNotAllowedMsg = "405 Method Not Allowed";
const std::string notFoundDesc =
"org.freedesktop.DBus.Error.FileNotFound: path or object not found";
const std::string propNotFoundDesc = "The specified property cannot be found";
const std::string noJsonDesc = "No JSON object could be decoded";
const std::string methodNotFoundDesc = "The specified method cannot be found";
+const std::string methodNotAllowedDesc = "Method not allowed";
void setErrorResponse(crow::Response &res, boost::beast::http::status result,
const std::string &desc, const std::string &msg)
@@ -1379,7 +1381,8 @@ inline void handleDBusUrl(const crow::Request &req, crow::Response &res,
return;
}
- res.result(boost::beast::http::status::method_not_allowed);
+ setErrorResponse(res, boost::beast::http::status::method_not_allowed,
+ methodNotAllowedDesc, methodNotAllowedMsg);
res.end();
}
OpenPOWER on IntegriCloud