diff --git a/redfish-core/src/utils/dbus_utils.cpp b/redfish-core/src/utils/dbus_utils.cpp index bf11aab7c..e1422c808 100644 --- a/redfish-core/src/utils/dbus_utils.cpp +++ b/redfish-core/src/utils/dbus_utils.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -83,10 +84,10 @@ void afterSetProperty( messages::internalError(asyncResp->res); return; } - // Only set success if another error hasn't already happened. + // Only set 204 if another error hasn't already happened. if (asyncResp->res.result() == boost::beast::http::status::ok) { - messages::success(asyncResp->res); + asyncResp->res.result(boost::beast::http::status::no_content); } }; diff --git a/test/redfish-core/include/utils/dbus_utils.cpp b/test/redfish-core/include/utils/dbus_utils.cpp index 148f9c8c9..ebde409d1 100644 --- a/test/redfish-core/include/utils/dbus_utils.cpp +++ b/test/redfish-core/include/utils/dbus_utils.cpp @@ -1,19 +1,17 @@ #include "utils/dbus_utils.hpp" -#include "http_request.hpp" +#include "async_resp.hpp" #include "http_response.hpp" #include +#include #include +#include -#include -#include +#include #include -#include -#include -#include #include namespace redfish::details @@ -31,6 +29,19 @@ TEST(DbusUtils, AfterPropertySetSuccess) afterSetProperty(asyncResp, "MyRedfishProperty", nlohmann::json("MyRedfishValue"), ec, msg); + EXPECT_EQ(asyncResp->res.result(), boost::beast::http::status::no_content); +} + +TEST(DbusUtils, AfterActionPropertySetSuccess) +{ + std::shared_ptr asyncResp = + std::make_shared(); + + boost::system::error_code ec; + sdbusplus::message_t msg; + afterSetPropertyAction(asyncResp, "MyRedfishProperty", + nlohmann::json("MyRedfishValue"), ec, msg); + EXPECT_EQ(asyncResp->res.result(), boost::beast::http::status::ok); EXPECT_EQ(asyncResp->res.jsonValue, R"({