Allow no spaces in content-type

For the content type header

application/json;charset=utf-8

The Redfish specification DSP0266 shows no space between the ; and
charset.  Sites like mozilla show the space included [1]

Considering the discrepancy, we should just accept both.

Resolves #271

[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type

Tested: Submitter reports issue fixed.

Change-Id: I77b7db91d65acc84f2221ec50985d4b942fbe77f
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/http/parsing.hpp b/http/parsing.hpp
index 9a19baf..cf81353 100644
--- a/http/parsing.hpp
+++ b/http/parsing.hpp
@@ -20,7 +20,9 @@
 inline bool isJsonContentType(std::string_view contentType)
 {
     return bmcweb::asciiIEquals(contentType, "application/json") ||
-           bmcweb::asciiIEquals(contentType, "application/json; charset=utf-8");
+           bmcweb::asciiIEquals(contentType,
+                                "application/json; charset=utf-8") ||
+           bmcweb::asciiIEquals(contentType, "application/json;charset=utf-8");
 }
 
 inline JsonParseResult parseRequestAsJson(const crow::Request& req,
diff --git a/meson.build b/meson.build
index 487ec1f..2d5f00e 100644
--- a/meson.build
+++ b/meson.build
@@ -426,6 +426,7 @@
   'test/http/http_connection_test.cpp',
   'test/http/mutual_tls.cpp',
   'test/http/router_test.cpp',
+  'test/http/parsing_test.cpp',
   'test/http/http_response_test.cpp',
   'test/http/utility_test.cpp',
   'test/http/verb_test.cpp',
diff --git a/test/http/parsing_test.cpp b/test/http/parsing_test.cpp
new file mode 100644
index 0000000..e51e89c
--- /dev/null
+++ b/test/http/parsing_test.cpp
@@ -0,0 +1,32 @@
+#include "http/parsing.hpp"
+
+#include <gtest/gtest.h>
+
+namespace
+{
+
+TEST(HttpParsing, isJsonContentType)
+{
+    EXPECT_TRUE(isJsonContentType("application/json"));
+
+    // The Redfish specification DSP0266 shows no space between the ; and
+    // charset.
+    EXPECT_TRUE(isJsonContentType("application/json;charset=utf-8"));
+
+    // Sites like mozilla show the space included [1]
+    //  https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
+    EXPECT_TRUE(isJsonContentType("application/json; charset=utf-8"));
+
+    EXPECT_TRUE(isJsonContentType("APPLICATION/JSON"));
+    EXPECT_TRUE(isJsonContentType("APPLICATION/JSON; CHARSET=UTF-8"));
+    EXPECT_TRUE(isJsonContentType("APPLICATION/JSON;CHARSET=UTF-8"));
+
+    EXPECT_FALSE(isJsonContentType("application/xml"));
+    EXPECT_FALSE(isJsonContentType(""));
+    EXPECT_FALSE(isJsonContentType(";"));
+    EXPECT_FALSE(isJsonContentType("application/json;"));
+    EXPECT_FALSE(isJsonContentType("application/json; "));
+    EXPECT_FALSE(isJsonContentType("application/json; charset=ascii"));
+    EXPECT_FALSE(isJsonContentType("json"));
+}
+} // namespace