Remove some boost includes
The less we rely on boost, and more on std algorithms, the less people
have to look up, and the more likely that our code will deduplicate.
Replace all uses of boost::algorithms with std alternatives.
Tested: Redfish Service Validator passes.
Change-Id: I8a26f39b5709adc444b4178e92f5f3c7b988b05b
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/http/parsing.hpp b/http/parsing.hpp
index 839b51c..9a19baf 100644
--- a/http/parsing.hpp
+++ b/http/parsing.hpp
@@ -2,10 +2,12 @@
#include "http/http_request.hpp"
#include "logging.hpp"
+#include "str_utility.hpp"
-#include <boost/algorithm/string/predicate.hpp>
#include <nlohmann/json.hpp>
+#include <algorithm>
+#include <cctype>
#include <string_view>
enum class JsonParseResult
@@ -15,14 +17,17 @@
Success,
};
+inline bool isJsonContentType(std::string_view contentType)
+{
+ return bmcweb::asciiIEquals(contentType, "application/json") ||
+ bmcweb::asciiIEquals(contentType, "application/json; charset=utf-8");
+}
+
inline JsonParseResult parseRequestAsJson(const crow::Request& req,
nlohmann::json& jsonOut)
{
- std::string_view contentType =
- req.getHeaderValue(boost::beast::http::field::content_type);
-
- if (!boost::iequals(contentType, "application/json") &&
- !boost::iequals(contentType, "application/json; charset=utf-8"))
+ if (!isJsonContentType(
+ req.getHeaderValue(boost::beast::http::field::content_type)))
{
BMCWEB_LOG_WARNING("Failed to parse content type on request");
#ifndef BMCWEB_INSECURE_IGNORE_CONTENT_TYPE