From 1873a04f43bb414408d1da9a5a775c05474603d2 Mon Sep 17 00:00:00 2001 From: Myung Bae Date: Mon, 1 Apr 2024 09:27:39 -0500 Subject: Reduce multi-level calls of req.req members Several places access the members of `req` indirectly like `req.req.method()`. This can be simplified as `req.method()` . This would also make the code clearer. Tested: - Compiles - Redfish service validator passes Change-Id: Ie129564ff907cdea7ac224b1e3d80cc0dedfbd7b Signed-off-by: Myung Bae --- test/redfish-core/include/utils/json_utils_test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/redfish-core/include/utils/json_utils_test.cpp b/test/redfish-core/include/utils/json_utils_test.cpp index 9245f25d87..5ef80eeba6 100644 --- a/test/redfish-core/include/utils/json_utils_test.cpp +++ b/test/redfish-core/include/utils/json_utils_test.cpp @@ -297,7 +297,7 @@ TEST(ReadJsonPatch, ValidElementsReturnsTrueResponseOkValuesUnpackedCorrectly) crow::Request req("{\"integer\": 1}", ec); // Ignore errors intentionally - req.req.set(boost::beast::http::field::content_type, "application/json"); + req.addHeader(boost::beast::http::field::content_type, "application/json"); int64_t integer = 0; ASSERT_TRUE(readJsonPatch(req, res, "integer", integer)); @@ -324,7 +324,7 @@ TEST(ReadJsonPatch, OdataIgnored) crow::Response res; std::error_code ec; crow::Request req(R"({"@odata.etag": "etag", "integer": 1})", ec); - req.req.set(boost::beast::http::field::content_type, "application/json"); + req.addHeader(boost::beast::http::field::content_type, "application/json"); // Ignore errors intentionally std::optional integer = 0; @@ -352,7 +352,7 @@ TEST(ReadJsonAction, ValidElementsReturnsTrueResponseOkValuesUnpackedCorrectly) crow::Response res; std::error_code ec; crow::Request req("{\"integer\": 1}", ec); - req.req.set(boost::beast::http::field::content_type, "application/json"); + req.addHeader(boost::beast::http::field::content_type, "application/json"); // Ignore errors intentionally int64_t integer = 0; @@ -367,7 +367,7 @@ TEST(ReadJsonAction, EmptyObjectReturnsTrueResponseOk) crow::Response res; std::error_code ec; crow::Request req({"{}"}, ec); - req.req.set(boost::beast::http::field::content_type, "application/json"); + req.addHeader(boost::beast::http::field::content_type, "application/json"); // Ignore errors intentionally std::optional integer = 0; -- cgit v1.2.3