Skip to content

Commit 247ae89

Browse files
committed
Make PATCH return 204 again
It was correctly pointed out that for PATCH, we cannot return 200 success without also returning the object, per Redfish. This commit partially reverts cdf25ff, to give PATCH the old (204) behavior again. Tested: Patch now returns 204 Change-Id: I8ede932a73ae064586d94c47393e4418350adb00 Signed-off-by: Ed Tanous <etanous@nvidia.com>
1 parent bd1299b commit 247ae89

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

redfish-core/src/utils/dbus_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ void afterSetProperty(
8282
messages::internalError(asyncResp->res);
8383
return;
8484
}
85-
// Only set success if another error hasn't already happened.
85+
// Only set 204 if another error hasn't already happened.
8686
if (asyncResp->res.result() == boost::beast::http::status::ok)
8787
{
88-
messages::success(asyncResp->res);
88+
asyncResp->res.result(boost::beast::http::status::no_content);
8989
}
9090
};
9191

test/redfish-core/include/utils/dbus_utils.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ TEST(DbusUtils, AfterPropertySetSuccess)
2929
afterSetProperty(asyncResp, "MyRedfishProperty",
3030
nlohmann::json("MyRedfishValue"), ec, msg);
3131

32+
EXPECT_EQ(asyncResp->res.result(), boost::beast::http::status::no_content);
33+
}
34+
35+
TEST(DbusUtils, AfterActionPropertySetSuccess)
36+
{
37+
std::shared_ptr<bmcweb::AsyncResp> asyncResp =
38+
std::make_shared<bmcweb::AsyncResp>();
39+
40+
boost::system::error_code ec;
41+
sdbusplus::message_t msg;
42+
afterSetPropertyAction(asyncResp, "MyRedfishProperty",
43+
nlohmann::json("MyRedfishValue"), ec, msg);
44+
3245
EXPECT_EQ(asyncResp->res.result(), boost::beast::http::status::ok);
3346
EXPECT_EQ(asyncResp->res.jsonValue,
3447
R"({

0 commit comments

Comments
 (0)