diff --git a/http/complete_response_fields.hpp b/http/complete_response_fields.hpp
new file mode 100644
index 0000000..1819db5
--- /dev/null
+++ b/http/complete_response_fields.hpp
@@ -0,0 +1,61 @@
+#pragma once
+
+#include "authentication.hpp"
+#include "http_request.hpp"
+#include "http_response.hpp"
+#include "http_utility.hpp"
+#include "json_html_serializer.hpp"
+#include "logging.hpp"
+#include "security_headers.hpp"
+#include "utils/hex_utils.hpp"
+
+#include <boost/beast/http/message.hpp>
+#include <boost/beast/http/string_body.hpp>
+#include <nlohmann/json.hpp>
+
+#include <array>
+
+namespace crow
+{
+
+inline void completeResponseFields(const Request& req, Response& res)
+{
+    BMCWEB_LOG_INFO << "Response: " << ' ' << req.url().encoded_path() << ' '
+                    << res.resultInt();
+    addSecurityHeaders(req, res);
+
+    authentication::cleanupTempSession(req);
+
+    res.setHashAndHandleNotModified();
+
+    if (res.body().empty() && res.jsonValue.is_structured())
+    {
+        using http_helpers::ContentType;
+        std::array<ContentType, 3> allowed{ContentType::CBOR, ContentType::JSON,
+                                           ContentType::HTML};
+        ContentType prefered =
+            getPreferedContentType(req.getHeaderValue("Accept"), allowed);
+
+        if (prefered == ContentType::HTML)
+        {
+            json_html_util::prettyPrintJson(res);
+        }
+        else if (prefered == ContentType::CBOR)
+        {
+            res.addHeader(boost::beast::http::field::content_type,
+                          "application/cbor");
+            nlohmann::json::to_cbor(res.jsonValue, res.body());
+        }
+        else
+        {
+            // Technically prefered could also be NoMatch here, but we'd
+            // like to default to something rather than return 400 for
+            // backward compatibility.
+            res.addHeader(boost::beast::http::field::content_type,
+                          "application/json");
+            res.body() = res.jsonValue.dump(
+                2, ' ', true, nlohmann::json::error_handler_t::replace);
+        }
+    }
+}
+} // namespace crow
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index 11964e0..3548870 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -3,12 +3,11 @@
 
 #include "async_resp.hpp"
 #include "authentication.hpp"
+#include "complete_response_fields.hpp"
 #include "http_response.hpp"
 #include "http_utility.hpp"
-#include "json_html_serializer.hpp"
 #include "logging.hpp"
 #include "mutual_tls.hpp"
-#include "security_headers.hpp"
 #include "ssl_key_handler.hpp"
 #include "utility.hpp"
 
@@ -314,66 +313,14 @@
         res = std::move(thisRes);
         res.keepAlive(keepAlive);
 
-        BMCWEB_LOG_INFO << "Response: " << this << ' '
-                        << req->url().encoded_path() << ' ' << res.resultInt()
-                        << " keepalive=" << keepAlive;
-
-        addSecurityHeaders(*req, res);
-
-        crow::authentication::cleanupTempSession(*req);
+        completeResponseFields(*req, res);
 
         if (!isAlive())
         {
-            // BMCWEB_LOG_DEBUG << this << " delete (socket is closed) " <<
-            // isReading
-            // << ' ' << isWriting;
-            // delete this;
-
-            // delete lambda with self shared_ptr
-            // to enable connection destruction
             res.setCompleteRequestHandler(nullptr);
             return;
         }
 
-        res.setHashAndHandleNotModified();
-
-        if (res.body().empty() && res.jsonValue.is_structured())
-        {
-            using http_helpers::ContentType;
-            std::array<ContentType, 3> allowed{
-                ContentType::CBOR, ContentType::JSON, ContentType::HTML};
-            ContentType prefered =
-                getPreferedContentType(req->getHeaderValue("Accept"), allowed);
-
-            if (prefered == ContentType::HTML)
-            {
-                json_html_util::prettyPrintJson(res);
-            }
-            else if (prefered == ContentType::CBOR)
-            {
-                res.addHeader(boost::beast::http::field::content_type,
-                              "application/cbor");
-                nlohmann::json::to_cbor(res.jsonValue, res.body());
-            }
-            else
-            {
-                // Technically prefered could also be NoMatch here, but we'd
-                // like to default to something rather than return 400 for
-                // backward compatibility.
-                res.addHeader(boost::beast::http::field::content_type,
-                              "application/json");
-                res.body() = res.jsonValue.dump(
-                    2, ' ', true, nlohmann::json::error_handler_t::replace);
-            }
-        }
-
-        if (res.resultInt() >= 400 && res.body().empty())
-        {
-            res.body() = std::string(res.reason());
-        }
-
-        res.addHeader(boost::beast::http::field::date, getCachedDateStr());
-
         doWrite(res);
 
         // delete lambda with self shared_ptr
