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>
This commit is contained in:
Arksine 2021-03-03 19:13:20 -05:00
parent d1dfa86081
commit 84f46b1cb1
1 changed files with 2 additions and 1 deletions

View File

@ -293,7 +293,8 @@ class DynamicRequestHandler(AuthorizedRequestHandler):
def parse_args(self): def parse_args(self):
args = self._parse_query() 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: try:
args.update(json.loads(self.request.body)) args.update(json.loads(self.request.body))
except json.JSONDecodeError: except json.JSONDecodeError: