Boost::urls::format

Boost 1.82 dropped a lovely new toy, boost::urls::format, which is a lot
like our urlFromPieces method, but better in that it makes the resulting
uris more readable, and allows doing things like fragments in a single
line instead of multiple.  We should prefer it in some cases.

Tested:
Redfish service validator passes.
Spot checks of URLs work as expected.
Unit tests pass.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ia7b38f0a95771c862507e7d5b4aa68aa1c98403c
diff --git a/http/routing.hpp b/http/routing.hpp
index 5bf6902..84213b2 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -16,6 +16,7 @@
 
 #include <boost/beast/ssl/ssl_stream.hpp>
 #include <boost/container/flat_map.hpp>
+#include <boost/url/format.hpp>
 #include <sdbusplus/unpack_properties.hpp>
 
 #include <cerrno>
@@ -1105,9 +1106,10 @@
             if (req.session->isConfigureSelfOnly)
             {
                 redfish::messages::passwordChangeRequired(
-                    asyncResp->res, crow::utility::urlFromPieces(
-                                        "redfish", "v1", "AccountService",
-                                        "Accounts", req.session->username));
+                    asyncResp->res,
+                    boost::urls::format(
+                        "/redfish/v1/AccountService/Accounts/{}",
+                        req.session->username));
             }
             return false;
         }
diff --git a/http/utility.hpp b/http/utility.hpp
index 6717327..aa64043 100644
--- a/http/utility.hpp
+++ b/http/utility.hpp
@@ -401,25 +401,12 @@
     return url;
 }
 
-inline boost::urls::url
-    urlFromPiecesDetail(const std::initializer_list<std::string_view> args)
-{
-    boost::urls::url url("/");
-    appendUrlPieces(url, args);
-    return url;
-}
 } // namespace details
 
 class OrMorePaths
 {};
 
 template <typename... AV>
-inline boost::urls::url urlFromPieces(const AV... args)
-{
-    return details::urlFromPiecesDetail({args...});
-}
-
-template <typename... AV>
 inline void appendUrlPieces(boost::urls::url& url, const AV... args)
 {
     details::appendUrlPieces(url, {args...});