From 84f46b1cb1d6e5513ec6945ac455ab7af262929c Mon Sep 17 00:00:00 2001
From: Arksine <arksine.code@gmail.com>
Date: Wed, 3 Mar 2021 19:13:20 -0500
Subject: [PATCH] app: fix issue with json Content-Type checks

Allow the Content-Type header to specify a "charset" by only validating the start of the string.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
---
 moonraker/app.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/moonraker/app.py b/moonraker/app.py
index aada261..98fdd0e 100644
--- a/moonraker/app.py
+++ b/moonraker/app.py
@@ -293,7 +293,8 @@ class DynamicRequestHandler(AuthorizedRequestHandler):
 
     def parse_args(self):
         args = self._parse_query()
-        if self.request.headers.get('Content-Type', "") == "application/json":
+        content_type = self.request.headers.get('Content-Type', "").strip()
+        if content_type.startswith("application/json"):
             try:
                 args.update(json.loads(self.request.body))
             except json.JSONDecodeError: