Rename FileBody to HttpBody

Now that our custom body type does things more than files, it makes
sense to rename it.  This commit renames the header itself, then all
instances of the class.

Tested: Basic GET requests succeed.
Change-Id: If4361ac8992fc7c268f48a336707f96e68d3576c
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/http/http2_connection.hpp b/http/http2_connection.hpp
index 97dcf4e..ed37480 100644
--- a/http/http2_connection.hpp
+++ b/http/http2_connection.hpp
@@ -39,7 +39,7 @@
 {
     Request req{};
     Response res{};
-    std::optional<bmcweb::FileBody::writer> writer;
+    std::optional<bmcweb::HttpBody::writer> writer;
 };
 
 template <typename Adaptor, typename Handler>
@@ -173,7 +173,7 @@
         }
         Http2StreamData& stream = it->second;
         crow::Response& res = stream.res;
-        http::response<bmcweb::FileBody>& fbody = res.response;
+        http::response<bmcweb::HttpBody>& fbody = res.response;
         stream.writer.emplace(fbody.base(), fbody.body());
 
         nghttp2_data_provider dataPrd{
diff --git a/http/http_file_body.hpp b/http/http_body.hpp
similarity index 98%
rename from http/http_file_body.hpp
rename to http/http_body.hpp
index 17554a4..84351ee 100644
--- a/http/http_file_body.hpp
+++ b/http/http_body.hpp
@@ -14,7 +14,7 @@
 
 namespace bmcweb
 {
-struct FileBody
+struct HttpBody
 {
     class writer;
     class reader;
@@ -27,7 +27,7 @@
     Base64,
 };
 
-class FileBody::value_type
+class HttpBody::value_type
 {
     boost::beast::file_posix fileHandle;
     std::optional<size_t> fileSize;
@@ -155,7 +155,7 @@
     }
 };
 
-class FileBody::writer
+class HttpBody::writer
 {
   public:
     using const_buffers_type = boost::asio::const_buffer;
@@ -236,7 +236,7 @@
     }
 };
 
-class FileBody::reader
+class HttpBody::reader
 {
     value_type& value;
 
diff --git a/http/http_client.hpp b/http/http_client.hpp
index 6f42f3e..2d03487 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -16,6 +16,7 @@
 #pragma once
 
 #include "async_resolve.hpp"
+#include "http_body.hpp"
 #include "http_response.hpp"
 #include "logging.hpp"
 #include "ssl_key_handler.hpp"
@@ -116,10 +117,10 @@
 
 struct PendingRequest
 {
-    boost::beast::http::request<bmcweb::FileBody> req;
+    boost::beast::http::request<bmcweb::HttpBody> req;
     std::function<void(bool, uint32_t, Response&)> callback;
     PendingRequest(
-        boost::beast::http::request<bmcweb::FileBody>&& reqIn,
+        boost::beast::http::request<bmcweb::HttpBody>&& reqIn,
         const std::function<void(bool, uint32_t, Response&)>& callbackIn) :
         req(std::move(reqIn)),
         callback(callbackIn)
@@ -138,8 +139,8 @@
     uint32_t connId;
 
     // Data buffers
-    http::request<bmcweb::FileBody> req;
-    using parser_type = http::response_parser<bmcweb::FileBody>;
+    http::request<bmcweb::HttpBody> req;
+    using parser_type = http::response_parser<bmcweb::HttpBody>;
     std::optional<parser_type> parser;
     boost::beast::flat_static_buffer<httpReadBufferSize> buffer;
     Response res;
@@ -733,7 +734,7 @@
                   const std::function<void(Response&)>& resHandler)
     {
         // Construct the request to be sent
-        boost::beast::http::request<bmcweb::FileBody> thisReq(
+        boost::beast::http::request<bmcweb::HttpBody> thisReq(
             verb, destUri.encoded_target(), 11, "", httpHeader);
         thisReq.set(boost::beast::http::field::host,
                     destUri.encoded_host_address());
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index ed3dc07..d60e74b 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -5,6 +5,7 @@
 #include "authentication.hpp"
 #include "complete_response_fields.hpp"
 #include "http2_connection.hpp"
+#include "http_body.hpp"
 #include "http_response.hpp"
 #include "http_utility.hpp"
 #include "logging.hpp"
@@ -611,8 +612,8 @@
     Handler* handler;
     // Making this a std::optional allows it to be efficiently destroyed and
     // re-created on Connection reset
-    std::optional<boost::beast::http::request_parser<bmcweb::FileBody>> parser;
-    std::optional<boost::beast::http::response_serializer<bmcweb::FileBody>>
+    std::optional<boost::beast::http::request_parser<bmcweb::HttpBody>> parser;
+    std::optional<boost::beast::http::response_serializer<bmcweb::HttpBody>>
         serializer;
 
     boost::beast::flat_static_buffer<8192> buffer;
diff --git a/http/http_request.hpp b/http/http_request.hpp
index 9cd4a0c..ee940d6 100644
--- a/http/http_request.hpp
+++ b/http/http_request.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include "common.hpp"
+#include "http_body.hpp"
 #include "sessions.hpp"
 
 #include <boost/asio/io_context.hpp>
@@ -8,7 +9,6 @@
 #include <boost/beast/http/message.hpp>
 #include <boost/beast/websocket.hpp>
 #include <boost/url/url.hpp>
-#include <http_file_body.hpp>
 
 #include <string>
 #include <string_view>
@@ -19,7 +19,7 @@
 
 struct Request
 {
-    boost::beast::http::request<bmcweb::FileBody> req;
+    boost::beast::http::request<bmcweb::HttpBody> req;
 
   private:
     boost::urls::url urlBase{};
@@ -33,7 +33,7 @@
     std::shared_ptr<persistent_data::UserSession> session;
 
     std::string userRole{};
-    Request(boost::beast::http::request<bmcweb::FileBody> reqIn,
+    Request(boost::beast::http::request<bmcweb::HttpBody> reqIn,
             std::error_code& ec) :
         req(std::move(reqIn))
     {
diff --git a/http/http_response.hpp b/http/http_response.hpp
index dca7682..afd51c1 100644
--- a/http/http_response.hpp
+++ b/http/http_response.hpp
@@ -1,5 +1,5 @@
 #pragma once
-#include "http_file_body.hpp"
+#include "http_body.hpp"
 #include "logging.hpp"
 #include "utils/hex_utils.hpp"
 
@@ -23,7 +23,7 @@
     template <typename Adaptor, typename Handler>
     friend class crow::Connection;
 
-    http::response<bmcweb::FileBody> response;
+    http::response<bmcweb::HttpBody> response;
 
     nlohmann::json jsonValue;
     using fields_type = http::header<false, http::fields>;
diff --git a/http/server_sent_event.hpp b/http/server_sent_event.hpp
index 730bdce..a8bccdb 100644
--- a/http/server_sent_event.hpp
+++ b/http/server_sent_event.hpp
@@ -1,4 +1,5 @@
 #pragma once
+#include "http_body.hpp"
 #include "http_request.hpp"
 #include "http_response.hpp"
 
@@ -272,7 +273,7 @@
 
     Adaptor adaptor;
 
-    using BodyType = bmcweb::FileBody;
+    using BodyType = bmcweb::HttpBody;
     boost::beast::http::response<BodyType> res;
     std::optional<boost::beast::http::response_serializer<BodyType>> serializer;
     boost::asio::io_context& ioc;
diff --git a/http/websocket.hpp b/http/websocket.hpp
index 388a3e4..d232c02 100644
--- a/http/websocket.hpp
+++ b/http/websocket.hpp
@@ -1,5 +1,6 @@
 #pragma once
 #include "async_resp.hpp"
+#include "http_body.hpp"
 #include "http_request.hpp"
 
 #include <boost/asio/buffer.hpp>
@@ -128,7 +129,7 @@
         }));
 
         // Make a pointer to keep the req alive while we accept it.
-        using Body = boost::beast::http::request<bmcweb::FileBody>;
+        using Body = boost::beast::http::request<bmcweb::HttpBody>;
         std::unique_ptr<Body> mobile = std::make_unique<Body>(req.req);
         Body* ptr = mobile.get();
         // Perform the websocket upgrade
@@ -227,7 +228,7 @@
 
     void acceptDone(const std::shared_ptr<Connection>& /*self*/,
                     const std::unique_ptr<
-                        boost::beast::http::request<bmcweb::FileBody>>& /*req*/,
+                        boost::beast::http::request<bmcweb::HttpBody>>& /*req*/,
                     const boost::system::error_code& ec)
     {
         if (ec)
diff --git a/meson.build b/meson.build
index d644b79..487ec1f 100644
--- a/meson.build
+++ b/meson.build
@@ -431,7 +431,7 @@
   'test/http/verb_test.cpp',
   'test/http/server_sent_event_test.cpp',
   'test/http/mutual_tls_meta.cpp',
-  'test/http/http_file_body_test.cpp',
+  'test/http/http_body_test.cpp',
   'test/include/dbus_utility_test.cpp',
   'test/include/google/google_service_root_test.cpp',
   'test/include/json_html_serializer.cpp',
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 8bdcb53..a176dd5 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -913,9 +913,9 @@
     asyncResp->res.jsonValue["Name"] = "HTTPS Certificate";
     asyncResp->res.jsonValue["Description"] = "HTTPS Certificate";
 
-    std::string certFileBody = getCertificateFromReqBody(asyncResp, req);
+    std::string certHttpBody = getCertificateFromReqBody(asyncResp, req);
 
-    if (certFileBody.empty())
+    if (certHttpBody.empty())
     {
         BMCWEB_LOG_ERROR("Cannot get certificate from request body.");
         messages::unrecognizedRequestBody(asyncResp->res);
@@ -923,7 +923,7 @@
     }
 
     std::shared_ptr<CertificateFile> certFile =
-        std::make_shared<CertificateFile>(certFileBody);
+        std::make_shared<CertificateFile>(certHttpBody);
 
     crow::connections::systemBus->async_method_call(
         [asyncResp, certFile](const boost::system::error_code& ec,
@@ -1019,9 +1019,9 @@
     {
         return;
     }
-    std::string certFileBody = getCertificateFromReqBody(asyncResp, req);
+    std::string certHttpBody = getCertificateFromReqBody(asyncResp, req);
 
-    if (certFileBody.empty())
+    if (certHttpBody.empty())
     {
         BMCWEB_LOG_ERROR("Cannot get certificate from request body.");
         messages::unrecognizedRequestBody(asyncResp->res);
@@ -1029,7 +1029,7 @@
     }
 
     std::shared_ptr<CertificateFile> certFile =
-        std::make_shared<CertificateFile>(certFileBody);
+        std::make_shared<CertificateFile>(certHttpBody);
 
     crow::connections::systemBus->async_method_call(
         [asyncResp, certFile](const boost::system::error_code& ec,
@@ -1141,9 +1141,9 @@
     {
         return;
     }
-    std::string certFileBody = getCertificateFromReqBody(asyncResp, req);
+    std::string certHttpBody = getCertificateFromReqBody(asyncResp, req);
 
-    if (certFileBody.empty())
+    if (certHttpBody.empty())
     {
         BMCWEB_LOG_ERROR("Cannot get certificate from request body.");
         messages::unrecognizedRequestBody(asyncResp->res);
@@ -1151,7 +1151,7 @@
     }
 
     std::shared_ptr<CertificateFile> certFile =
-        std::make_shared<CertificateFile>(certFileBody);
+        std::make_shared<CertificateFile>(certHttpBody);
     crow::connections::systemBus->async_method_call(
         [asyncResp, certFile](const boost::system::error_code& ec,
                               const std::string& objectPath) {
diff --git a/test/http/http_file_body_test.cpp b/test/http/http_body_test.cpp
similarity index 76%
rename from test/http/http_file_body_test.cpp
rename to test/http/http_body_test.cpp
index 4eaa93b..6367cf9 100644
--- a/test/http/http_file_body_test.cpp
+++ b/test/http/http_body_test.cpp
@@ -1,5 +1,5 @@
 #include "file_test_utilities.hpp"
-#include "http_file_body.hpp"
+#include "http_body.hpp"
 
 #include <boost/system/error_code.hpp>
 
@@ -17,58 +17,58 @@
 namespace
 {
 
-TEST(HttpFileBodyValueType, MoveString)
+TEST(HttpHttpBodyValueType, MoveString)
 {
-    FileBody::value_type value("teststring");
+    HttpBody::value_type value("teststring");
     // Move constructor
-    FileBody::value_type value2(std::move(value));
+    HttpBody::value_type value2(std::move(value));
     EXPECT_EQ(value2.encodingType, EncodingType::Raw);
     EXPECT_EQ(value2.str(), "teststring");
     EXPECT_EQ(value2.payloadSize(), 10);
 }
 
-TEST(HttpFileBodyValueType, MoveOperatorString)
+TEST(HttpHttpBodyValueType, MoveOperatorString)
 {
-    FileBody::value_type value;
+    HttpBody::value_type value;
     value.str() = "teststring";
     // Move constructor
-    FileBody::value_type value2 = std::move(value);
+    HttpBody::value_type value2 = std::move(value);
     EXPECT_EQ(value2.encodingType, EncodingType::Raw);
     EXPECT_EQ(value2.str(), "teststring");
     EXPECT_EQ(value2.payloadSize(), 10);
 }
 
-TEST(HttpFileBodyValueType, copysignl)
+TEST(HttpHttpBodyValueType, copysignl)
 {
-    FileBody::value_type value;
+    HttpBody::value_type value;
     value.str() = "teststring";
     // Move constructor
-    FileBody::value_type value2(value);
+    HttpBody::value_type value2(value);
     EXPECT_EQ(value2.encodingType, EncodingType::Raw);
     EXPECT_EQ(value2.str(), "teststring");
     EXPECT_EQ(value2.payloadSize(), 10);
 }
 
-TEST(HttpFileBodyValueType, CopyOperatorString)
+TEST(HttpHttpBodyValueType, CopyOperatorString)
 {
-    FileBody::value_type value;
+    HttpBody::value_type value;
     value.str() = "teststring";
     // Move constructor
-    FileBody::value_type value2 = value;
+    HttpBody::value_type value2 = value;
     EXPECT_EQ(value2.encodingType, EncodingType::Raw);
     EXPECT_EQ(value2.str(), "teststring");
     EXPECT_EQ(value2.payloadSize(), 10);
 }
 
-TEST(HttpFileBodyValueType, MoveFile)
+TEST(HttpHttpBodyValueType, MoveFile)
 {
-    FileBody::value_type value(EncodingType::Base64);
+    HttpBody::value_type value(EncodingType::Base64);
     std::string filepath = makeFile("teststring");
     boost::system::error_code ec;
     value.open(filepath.c_str(), boost::beast::file_mode::read, ec);
     ASSERT_FALSE(ec);
     // Move constructor
-    FileBody::value_type value2(std::move(value));
+    HttpBody::value_type value2(std::move(value));
     std::array<char, 11> buffer{};
     size_t out = value2.file().read(buffer.data(), buffer.size(), ec);
     ASSERT_FALSE(ec);
@@ -83,15 +83,15 @@
     EXPECT_EQ(value2.payloadSize(), 16);
 }
 
-TEST(HttpFileBodyValueType, MoveOperatorFile)
+TEST(HttpHttpBodyValueType, MoveOperatorFile)
 {
-    FileBody::value_type value(EncodingType::Base64);
+    HttpBody::value_type value(EncodingType::Base64);
     std::string filepath = makeFile("teststring");
     boost::system::error_code ec;
     value.open(filepath.c_str(), boost::beast::file_mode::read, ec);
     ASSERT_FALSE(ec);
     // Move constructor
-    FileBody::value_type value2 = std::move(value);
+    HttpBody::value_type value2 = std::move(value);
     std::array<char, 11> buffer{};
     size_t out = value2.file().read(buffer.data(), buffer.size(), ec);
     ASSERT_FALSE(ec);
@@ -105,9 +105,9 @@
     EXPECT_EQ(value2.payloadSize(), 16);
 }
 
-TEST(HttpFileBodyValueType, SetFd)
+TEST(HttpBodyValueType, SetFd)
 {
-    FileBody::value_type value(EncodingType::Base64);
+    HttpBody::value_type value(EncodingType::Base64);
     std::string filepath = makeFile("teststring");
 
     boost::system::error_code ec;
diff --git a/test/http/http_response_test.cpp b/test/http/http_response_test.cpp
index c5bfbdc..457cd7a 100644
--- a/test/http/http_response_test.cpp
+++ b/test/http/http_response_test.cpp
@@ -2,6 +2,7 @@
 #include "boost/beast/core/flat_buffer.hpp"
 #include "boost/beast/http/serializer.hpp"
 #include "file_test_utilities.hpp"
+#include "http/http_body.hpp"
 #include "http/http_response.hpp"
 
 #include <filesystem>
@@ -24,11 +25,11 @@
     EXPECT_EQ(res.result(), boost::beast::http::status::ok);
 }
 
-std::string getData(boost::beast::http::response<bmcweb::FileBody>& m)
+std::string getData(boost::beast::http::response<bmcweb::HttpBody>& m)
 {
     std::string ret;
 
-    boost::beast::http::response_serializer<bmcweb::FileBody> sr{m};
+    boost::beast::http::response_serializer<bmcweb::HttpBody> sr{m};
     sr.split(true);
 
     auto reader = [&sr, &ret](const boost::system::error_code& ec2,
@@ -73,7 +74,7 @@
     EXPECT_EQ(*res.body(), bodyvalue);
     verifyHeaders(res);
 }
-TEST(HttpResponse, FileBody)
+TEST(HttpResponse, HttpBody)
 {
     crow::Response res;
     addHeaders(res);
@@ -83,7 +84,7 @@
     verifyHeaders(res);
     std::filesystem::remove(path);
 }
-TEST(HttpResponse, FileBodyWithFd)
+TEST(HttpResponse, HttpBodyWithFd)
 {
     crow::Response res;
     addHeaders(res);
@@ -95,7 +96,7 @@
     std::filesystem::remove(path);
 }
 
-TEST(HttpResponse, Base64FileBodyWithFd)
+TEST(HttpResponse, Base64HttpBodyWithFd)
 {
     crow::Response res;
     addHeaders(res);
@@ -145,7 +146,7 @@
     testFileData(res, data);
 }
 
-TEST(HttpResponse, Base64FileBodyWriter)
+TEST(HttpResponse, Base64HttpBodyWriter)
 {
     crow::Response res;
     std::string data = "sample text";
@@ -157,7 +158,7 @@
     std::filesystem::remove(path);
 }
 
-TEST(HttpResponse, Base64FileBodyWriterLarge)
+TEST(HttpResponse, Base64HttpBodyWriterLarge)
 {
     crow::Response res;
     std::string data = generateBigdata();
@@ -174,7 +175,7 @@
     std::filesystem::remove(path);
 }
 
-TEST(HttpResponse, FileBodyWriterLarge)
+TEST(HttpResponse, HttpBodyWriterLarge)
 {
     crow::Response res;
     std::string data = generateBigdata();